FixtureRule works in the tests, however, it doesn't initialise the annotated fixtures of a private static inner class - which would be useful in cases when inner classes are used in order to make the code cleaner.
Currently the following test fails because 'new InnerClass().field' is not initialised.
public class FixtureTest {
@Rule public final FixtureRule fixtureRule = FixtureRule.initFixtures();
@Fixture private String field;
@org.junit.Test
public void test() {
assertThat(field).isNotNull();
assertThat(new InnerClass().field).isNotNull();
}
private static class InnerClass {
@Fixture private String field;
}
This is because you're "newing" up the instance of InnerClass rather than getting JFixture to create it. If you use JFixture to create the instance you can remove @Fixture' from theString field` too
FixtureRule works in the tests, however, it doesn't initialise the annotated fixtures of a private static inner class - which would be useful in cases when inner classes are used in order to make the code cleaner.
Currently the following test fails because 'new InnerClass().field' is not initialised.
public class FixtureTest {
}