Skip to content

Releases: weld/weld-testing

2.0.0.Final

17 Apr 09:00
Compare
Choose a tag to compare

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

27 Sep 13:48
Compare
Choose a tag to compare
  • Fixed a bug where annotations you used along with @EnableAutoWeld were not inherited
  • 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 to Type
  • Expanded test coverage

1.3.0.Final

22 Jun 14:16
Compare
Choose a tag to compare
  • 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

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

27 Mar 15:13
Compare
Choose a tag to compare
  • Search class hierarchy for @WeldSetup (#32)
  • MockBean - add static method to create builder initialized from a class (#33)
  • WeldInitiator#from() and of() methods support extensions as well (#31)

1.2.1.Final

24 Jan 11:39
Compare
Choose a tag to compare
  • 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

18 Dec 09:52
Compare
Choose a tag to compare
  • 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 to org.jboss.weld.junit.MockBean
  • org.jboss.weld.junit4.WeldInitiator is currently missing createWeld() method, see also #24

1.1.0.Final

11 Apr 09:20
Compare
Choose a tag to compare