Releases: weld/weld-testing
Releases · weld/weld-testing
2.0.0.Final
We have a new major version in which we are dropping support CDI 1.2 (Weld 2.4) and fully moving to CDI 2.0 (Weld 3). Apart from that, this release brings:
- Removal of
@OverrideBean
, as it effectively duplicating what can be achieved by declaring an alternative - Introduction of
@ExcludeBean
and@ExcludeBeanClasses
which allow to exclude some classes from automatic discovery and replace them with ad-hoc producers - Users can now define
MockBean
with priority, making it a globally enabled alternative - Synthetic bean archive now adds a dummy bean in case there is an alternative enabled to avoid a corner case where the archive would be considered empty if no other bean than alternative was present
- Update to JUnit versions used internally
1.3.1.Final
- Fixed a bug where annotations you used along with
@EnableAutoWeld
were not inherited- Thanks @kaiwinter for pointing that out!
- Bumped Weld versions to latest releases
- 2.4.8.Final (CDI 1.2) and 3.0.5.Final (CDI 2.0)
@OverrideBean
is no longer (incorrectly) applicable toType
- Expanded test coverage
1.3.0.Final
- JUnit5 extension now offers annotation based configuration - see the example bellow (#44 and #42)
- Thanks @kdubb for contribution!
- Fire
@Initialized
and@Destroyed
lifecycle events for activated contexts (#50)- Payload is
java.lang.Object
- We don't fire
@BeforeDestroyed
as we're still compatible with CDI 1.2
- Payload is
JUnit5 annotation based configuration example
@EnableAutoWeld
@AddPackages(Alpha.class) // Adds all bean classes from the package of Alpha
@ActivateScopes(RequestScoped.class) // Activates the request scope for the duration of the test
public class SimpleTest {
// Injected automatically
@Inject
Foo foo;
@Test
public void testFoo() {
// Weld container is started automatically
assertEquals("baz", foo.getBaz());
}
}
For more examples see our test suite.
1.2.2.Final
1.2.1.Final
MockBean
- make it possible to specify the bean class- Add convenient
MockBean.Builder.selectedAlternative()
method (#22) - Introduce
MockInterceptor
- Add
WeldInitiator.performDefaultDiscovery()
method
1.2.0.Final
- added JUnit5 support (#9)
- dropped JDK7 support
- introduced mocking injection services to easily mock
@Resource
,@EJB
,@PersistenceUnit
and@PersistentContext
injection points (#18)
Migration notes
org.jboss.weld.junit4.MockBean
was renamed toorg.jboss.weld.junit.MockBean
org.jboss.weld.junit4.WeldInitiator
is currently missingcreateWeld()
method, see also #24
1.1.0.Final
WeldInitiator
- make it possible to add beans duringAfterBeanDiscovery
(#4)- also add
MockBean
with builder (see also https://github.com/weld/weld-junit/blob/master/junit4/src/test/java/org/jboss/weld/junit4/bean/AddBeanTest.java)