コード例 #1
0
 /**
  * InjectionObjectFactory is advised to use a custom package for the lookup of implementation. But
  * as the package doesn't exist there isn't an implementation.
  */
 @Test
 public void testCustomPackageInvalid() {
   LookupContext lookupContext =
       new LookupContext("com.github.kaiwinter.instantiator.testmodel.inject.notexisting");
   InjectionObjectFactory factory = new InjectionObjectFactory(lookupContext);
   StartingServiceAsInject instance = factory.getInstance(StartingServiceAsInject.class);
   assertNull(instance.getServiceBeanClass());
 }
コード例 #2
0
  @Test
  public void testInject() {
    StartingServiceAsInject instance =
        new InjectionObjectFactory().getInstance(StartingServiceAsInject.class);

    // Test if objects in test object are set
    assertNotNull(instance.getServiceBeanClass());
    assertNotNull(instance.getServiceBeanInterface());

    // Test if objects of objects in test object are set
    assertNotNull(instance.getServiceBeanClass().getDaoClass());
    assertNotNull(instance.getServiceBeanInterface().getDaoInterface());
  }