private T createAndInitialize() { final T factory = createFactory(); factory.init(this.contextMock); return factory; }
@Test void testInit() { final T factory = createFactory(); factory.init(this.contextMock); assertThat(factory.getContext(), sameInstance(this.contextMock)); }
@Test void testMissingContextThrowsException() { final T factory = createFactory(); factory.init(null); assertThrows(NullPointerException.class, () -> factory.getContext(), "Context was not initialized"); }