Search in sources :

Example 1 with MockInterface1_Decorator3

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

the class DefaultInjectorDecorationTest method testDecoratorChain.

@Test
public void testDecoratorChain() {
    Module module = binder -> {
        binder.bind(MockInterface1.class).to(MockImplementation1.class);
        binder.decorate(MockInterface1.class).before(MockInterface1_Decorator1.class);
        binder.decorate(MockInterface1.class).before(MockInterface1_Decorator2.class);
        binder.decorate(MockInterface1.class).after(MockInterface1_Decorator3.class);
    };
    DefaultInjector injector = new DefaultInjector(module);
    MockInterface1 service = injector.getInstance(MockInterface1.class);
    assertNotNull(service);
    assertEquals("<[{MyName}]>", service.getName());
}
Also used : MockInterface1(org.apache.cayenne.di.mock.MockInterface1) MockInterface1_Decorator1(org.apache.cayenne.di.mock.MockInterface1_Decorator1) Assert.assertNotNull(org.junit.Assert.assertNotNull) MockInterface1_Decorator3(org.apache.cayenne.di.mock.MockInterface1_Decorator3) Module(org.apache.cayenne.di.Module) MockImplementation1(org.apache.cayenne.di.mock.MockImplementation1) MockInterface1_Decorator2(org.apache.cayenne.di.mock.MockInterface1_Decorator2) MockInterface1_Decorator5(org.apache.cayenne.di.mock.MockInterface1_Decorator5) Test(org.junit.Test) MockInterface1_Decorator4(org.apache.cayenne.di.mock.MockInterface1_Decorator4) Assert.assertEquals(org.junit.Assert.assertEquals) MockInterface1_Decorator3(org.apache.cayenne.di.mock.MockInterface1_Decorator3) MockInterface1_Decorator2(org.apache.cayenne.di.mock.MockInterface1_Decorator2) MockInterface1(org.apache.cayenne.di.mock.MockInterface1) Module(org.apache.cayenne.di.Module) MockImplementation1(org.apache.cayenne.di.mock.MockImplementation1) MockInterface1_Decorator1(org.apache.cayenne.di.mock.MockInterface1_Decorator1) Test(org.junit.Test)

Aggregations

Module (org.apache.cayenne.di.Module)1 MockImplementation1 (org.apache.cayenne.di.mock.MockImplementation1)1 MockInterface1 (org.apache.cayenne.di.mock.MockInterface1)1 MockInterface1_Decorator1 (org.apache.cayenne.di.mock.MockInterface1_Decorator1)1 MockInterface1_Decorator2 (org.apache.cayenne.di.mock.MockInterface1_Decorator2)1 MockInterface1_Decorator3 (org.apache.cayenne.di.mock.MockInterface1_Decorator3)1 MockInterface1_Decorator4 (org.apache.cayenne.di.mock.MockInterface1_Decorator4)1 MockInterface1_Decorator5 (org.apache.cayenne.di.mock.MockInterface1_Decorator5)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Assert.assertNotNull (org.junit.Assert.assertNotNull)1 Test (org.junit.Test)1