use of org.apache.cayenne.di.mock.MockInterface1 in project cayenne by apache.
the class DefaultInjectorTest method testShutdown.
@Test
public void testShutdown() {
MockImplementation1_EventAnnotations.reset();
Module module = binder -> binder.bind(MockInterface1.class).to(MockImplementation1_EventAnnotations.class).inSingletonScope();
DefaultInjector injector = new DefaultInjector(module);
MockInterface1 instance1 = injector.getInstance(MockInterface1.class);
assertEquals("XuI", instance1.getName());
assertFalse(MockImplementation1_EventAnnotations.shutdown1);
assertFalse(MockImplementation1_EventAnnotations.shutdown2);
assertFalse(MockImplementation1_EventAnnotations.shutdown3);
injector.shutdown();
assertTrue(MockImplementation1_EventAnnotations.shutdown1);
assertTrue(MockImplementation1_EventAnnotations.shutdown2);
assertTrue(MockImplementation1_EventAnnotations.shutdown3);
}
Aggregations