Search in sources :

Example 1 with MockImplementation4

use of org.apache.cayenne.di.mock.MockImplementation4 in project cayenne by apache.

the class DefaultInjectorInjectionTest method testConstructorInjection.

@Test
public void testConstructorInjection() {
    Module module = binder -> {
        binder.bind(MockInterface1.class).to(MockImplementation1.class);
        binder.bind(MockInterface4.class).to(MockImplementation4.class);
    };
    DefaultInjector injector = new DefaultInjector(module);
    MockInterface4 service = injector.getInstance(MockInterface4.class);
    assertNotNull(service);
    assertEquals("constructor_MyName", service.getName());
}
Also used : MockImplementation1_ListConfigurationMock5(org.apache.cayenne.di.mock.MockImplementation1_ListConfigurationMock5) Module(org.apache.cayenne.di.Module) MockImplementation2_ListConfiguration(org.apache.cayenne.di.mock.MockImplementation2_ListConfiguration) ArrayList(java.util.ArrayList) CoreMatchers.instanceOf(org.hamcrest.CoreMatchers.instanceOf) MockImplementation1Alt(org.apache.cayenne.di.mock.MockImplementation1Alt) MockImplementation1_WithInjector(org.apache.cayenne.di.mock.MockImplementation1_WithInjector) Map(java.util.Map) Key(org.apache.cayenne.di.Key) MockImplementation1_ListConfiguration(org.apache.cayenne.di.mock.MockImplementation1_ListConfiguration) MockImplementation1_MapConfiguration(org.apache.cayenne.di.mock.MockImplementation1_MapConfiguration) MockImplementation1Alt2(org.apache.cayenne.di.mock.MockImplementation1Alt2) Collection(java.util.Collection) MockImplementation1(org.apache.cayenne.di.mock.MockImplementation1) MockImplementation2(org.apache.cayenne.di.mock.MockImplementation2) MockImplementation2_Named(org.apache.cayenne.di.mock.MockImplementation2_Named) Test(org.junit.Test) MockImplementation3(org.apache.cayenne.di.mock.MockImplementation3) MockImplementation4(org.apache.cayenne.di.mock.MockImplementation4) MockImplementation5(org.apache.cayenne.di.mock.MockImplementation5) MockInterface2(org.apache.cayenne.di.mock.MockInterface2) MockImplementation1_MapWithWildcards(org.apache.cayenne.di.mock.MockImplementation1_MapWithWildcards) MockImplementation2_ConstructorProvider(org.apache.cayenne.di.mock.MockImplementation2_ConstructorProvider) MockInterface1(org.apache.cayenne.di.mock.MockInterface1) MockImplementation4Alt2(org.apache.cayenne.di.mock.MockImplementation4Alt2) MockImplementation2Sub1(org.apache.cayenne.di.mock.MockImplementation2Sub1) MockImplementation4Alt(org.apache.cayenne.di.mock.MockImplementation4Alt) DIRuntimeException(org.apache.cayenne.di.DIRuntimeException) MockInterface4(org.apache.cayenne.di.mock.MockInterface4) Assert(org.junit.Assert) MockInterface3(org.apache.cayenne.di.mock.MockInterface3) MockInterface5(org.apache.cayenne.di.mock.MockInterface5) MockImplementation4(org.apache.cayenne.di.mock.MockImplementation4) Module(org.apache.cayenne.di.Module) MockInterface4(org.apache.cayenne.di.mock.MockInterface4) MockImplementation1(org.apache.cayenne.di.mock.MockImplementation1) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Map (java.util.Map)1 DIRuntimeException (org.apache.cayenne.di.DIRuntimeException)1 Key (org.apache.cayenne.di.Key)1 Module (org.apache.cayenne.di.Module)1 MockImplementation1 (org.apache.cayenne.di.mock.MockImplementation1)1 MockImplementation1Alt (org.apache.cayenne.di.mock.MockImplementation1Alt)1 MockImplementation1Alt2 (org.apache.cayenne.di.mock.MockImplementation1Alt2)1 MockImplementation1_ListConfiguration (org.apache.cayenne.di.mock.MockImplementation1_ListConfiguration)1 MockImplementation1_ListConfigurationMock5 (org.apache.cayenne.di.mock.MockImplementation1_ListConfigurationMock5)1 MockImplementation1_MapConfiguration (org.apache.cayenne.di.mock.MockImplementation1_MapConfiguration)1 MockImplementation1_MapWithWildcards (org.apache.cayenne.di.mock.MockImplementation1_MapWithWildcards)1 MockImplementation1_WithInjector (org.apache.cayenne.di.mock.MockImplementation1_WithInjector)1 MockImplementation2 (org.apache.cayenne.di.mock.MockImplementation2)1 MockImplementation2Sub1 (org.apache.cayenne.di.mock.MockImplementation2Sub1)1 MockImplementation2_ConstructorProvider (org.apache.cayenne.di.mock.MockImplementation2_ConstructorProvider)1 MockImplementation2_ListConfiguration (org.apache.cayenne.di.mock.MockImplementation2_ListConfiguration)1 MockImplementation2_Named (org.apache.cayenne.di.mock.MockImplementation2_Named)1 MockImplementation3 (org.apache.cayenne.di.mock.MockImplementation3)1