-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Swap to Weld 3, remove profiles, bump project version to 2.0.0-SNAPSHOT. * Enhance MockBean.Builder, introduce MockBeanWithPriority, add tests. * Simplify Travis matrix. * Remove Literals which are now present in CDI API, simplify mocked services.
- Loading branch information
Showing
19 changed files
with
305 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 0 additions & 46 deletions
46
junit-common/src/main/java/org/jboss/weld/junit/DestroyedLiteral.java
This file was deleted.
Oops, something went wrong.
46 changes: 0 additions & 46 deletions
46
junit-common/src/main/java/org/jboss/weld/junit/InitializedLiteral.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
junit-common/src/main/java/org/jboss/weld/junit/MockBeanWithPriority.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.jboss.weld.junit; | ||
|
||
import javax.enterprise.inject.spi.Prioritized; | ||
import java.lang.annotation.Annotation; | ||
import java.lang.reflect.Type; | ||
import java.util.Set; | ||
|
||
/** | ||
* A subclass of {@link MockBean} implementing {@link Prioritized} hence allowing for globally enabled alternatives. | ||
* Used instead of {@link MockBean} if user specified {@link MockBean.Builder#priority(int)}. | ||
* | ||
* @author Matej Novotny | ||
*/ | ||
class MockBeanWithPriority<T> extends MockBean<T> implements Prioritized { | ||
|
||
private final int priority; | ||
|
||
MockBeanWithPriority(Class<?> beanClass, Set<Class<? extends Annotation>> stereotypes, boolean alternative, | ||
boolean selectForSyntheticBeanArchive, int priority, String name, | ||
Set<Annotation> qualifiers, Set<Type> types, Class<? extends Annotation> scope, | ||
CreateFunction<T> createCallback, DestroyFunction<T> destroyCallback) { | ||
super(beanClass, stereotypes, alternative, selectForSyntheticBeanArchive, name, qualifiers, types, scope, createCallback, destroyCallback); | ||
if (priority <= 0) { | ||
throw new IllegalArgumentException("MockBean cannot have priority equal or lower than 0!"); | ||
} | ||
this.priority = priority; | ||
} | ||
|
||
@Override | ||
public int getPriority() { | ||
return this.priority; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.