Skip to content

8.3 | 7.3

Compare
Choose a tag to compare
@rbygrave rbygrave released this 20 May 01:30
· 1293 commits to master since this release

Comments

This release adds great support for "component testing". I'll be updating the docs to reflect but there are 2 main things:

  1. There are 3 levels of scopes in testing - A Global scope (via @TestScope) used across all tests + Test class (forAll / static fields) scope + Test instance (forEach / instance fields). Most component tests will use 2 or 3 of these levels in a layering way (parent/child BeanScopes).
  2. The junit5 InjectExtension has a Plugin API and I've used this with avaje-jex-test. This plugin API detects via types (e.g. http client type) if it should be part of a test and can create instances that get injected into the test. For example, with avaje-jex-test the plugin detects if a http client type is being injected and if so creates a http server using a random port + client, supplies the client to the test and at the end of the test scope shuts down the http server.

So with these features in place avaje-inject-test is now what I've wanted it to be wrt support of component testing. Docs and examples need some attention to reflect these features.

Cheers, Rob.

Issues

#213 - BUG: reference to Builder is ambiguous ... when injecting a class with simple name of Builder
#207 - Rename "with" methods with deprecate. e.g. migrate withBean() -> bean(), withSpy() -> spy()
#206 - Add BeanScope.builder() to replace BeanScope.newBuilder() with deprecation.
#202 - Can not apply Spy to a bean in the test scope bug

Enhancements

#214 - ENH: Add support for using @Prototype on @Factory @Bean methods enhancement
#211 #212 - ENH: Add Plugin API for avaje-inject-test ... e.g. Inject a http client into a test and start/stop http server
#211 - ENH: Add Plugin API for avaje-inject-test ... e.g. Inject a http client into a test and start/stop http server
#208 #209 - Fix @InjectTest / InjectExtension to support static field injection
#203 #204 #205 - Add @InjectTest + TestScopeBean with helper methods to programmatically use the test scope
#204 - Add @InjectTest as synonym for @ExtendWith(InjectExtension.class)
#203 - Add TestScopeBean as helper methods to programmatically use the test scope