You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a follow-up to #774, it now is not as easy to write a rule that verifies that we do not follow a pattern, such as the below which ensures we don't use field injection with Spring's Dependency Injection:
@ArchTestvoidrequireNoAutowiredFieldInjection(JavaClassesclasses) {
classesThatAreNotTests()
.and()
.containAnyFieldsThat(
describe(
"are Autowired by Spring",
f -> f.tryGetAnnotationOfType(Autowired.class).isPresent()))
.should()
.containNumberOfElements(equalTo(0))
.check(classes);
}
This now would require running the whole set of tests with archRule.failOnEmptyShould which although fine, leads to the risk that we have other tests that need to assert i.e. .containNumberOfElements(greaterThan(0)).
The text was updated successfully, but these errors were encountered:
As a follow-up to #774, it now is not as easy to write a rule that verifies that we do not follow a pattern, such as the below which ensures we don't use field injection with Spring's Dependency Injection:
This now would require running the whole set of tests with
archRule.failOnEmptyShould
which although fine, leads to the risk that we have other tests that need to assert i.e..containNumberOfElements(greaterThan(0))
.The text was updated successfully, but these errors were encountered: