Why does my my GIN factory always return null?

253 Views Asked by At

I am trying to write a Jukito test that uses a GIN factory I created.

My factory looks like so:

public interface ClientFactory {

    public DOMModel create(Entity ref);

}

I am binding it in my gin module like so:

public class ClientModule extends AbstractGinModule {

    @Override
    protected void configure() {

        install(new GinFactoryModuleBuilder().build(ClientFactory.class));

    }

}

DOMModel looks like so:

public class DOMModel {

    ...

@Inject
public DOMModel(CollabClientFactory collabFactory, @Assisted Entity ref, @Assisted Document domDoc){
    this.colabClient = collabFactory.create("DOMMODEL:"+ref.getID(), "com.server.impl.DOMCollabSite.java", collaborator);
    }

    ...
}

Then my test looks like this:

@RunWith(JukitoRunner.class)
public class Test {

  public static class Module extends JukitoModule {
    protected void configureTest() {

        install(new GinModuleAdapter(new ClientModule()));

    }
  }

  @Inject
  ClientFactory modelFactory;

  @Test
  public void testSimple() throws Exception{
       Entity entity = new Entity(){
            @Override
            public String getID() {

             return "someID";
            }
       };

       DOMModel model1 = modelFactory.create(entity);

         assertNotNull(model1);
    }

}

This test fails because model1 is null, however I get no other errors or warnings whatsoever. What is wrong?

0

There are 0 best solutions below