use of com.google.gwt.inject.rebind.util.GuiceUtil in project google-gin by gwtplus.
the class FactoryBindingTest method testTwoUnnamedStringAnnotations.
public void testTwoUnnamedStringAnnotations() {
try {
new FactoryBinding(Collections.<Key<?>, TypeLiteral<?>>emptyMap(), Key.get(TwoUnnamedStringsFactory.class), CONTEXT, new GuiceUtil(createInjectableCollector()), null);
fail("Expected ConfigurationException.");
} catch (ConfigurationException e) {
assertTrue(e.getMessage().contains("has more than one parameter of type " + "java.lang.String annotated with @Assisted(\"\")."));
}
}
use of com.google.gwt.inject.rebind.util.GuiceUtil in project google-gin by gwtplus.
the class GinjectorBindingsTest method setUp.
@Override
public void setUp() {
control = createControl();
niceControl = createNiceControl();
nameGenerator = control.createMock("nameGenerator", NameGenerator.class);
logger = niceControl.createMock("logger", TreeLogger.class);
guiceUtil = control.createMock("guiceUtil", GuiceUtil.class);
{
@SuppressWarnings("unchecked") Provider<GinjectorBindings> tmpProvider = control.createMock("ginjectorBindingsProvider", Provider.class);
ginjectorBindingsProvider = tmpProvider;
}
collector = control.createMock("collector", MemberCollector.class);
errorManager = control.createMock("errorManager", ErrorManager.class);
bindingResolver = control.createMock("bindingResolver", BindingResolver.class);
methodCallUtil = control.createMock("methodCallUtil", MethodCallUtil.class);
bindingFactory = new BindingFactoryImpl(errorManager, guiceUtil, DummyInjectorInterface.class, methodCallUtil);
}
use of com.google.gwt.inject.rebind.util.GuiceUtil in project gwt-test-utils by gwt-test-utils.
the class GInjectorCreateHandler method readGuiceModules.
private Set<Module> readGuiceModules(Class<? extends GinModule>[] classLiterals, Class<? extends Ginjector> ginectorClass) throws Exception {
Set<Module> modules = new HashSet<>();
for (Class<? extends GinModule> literal : classLiterals) {
LOGGER.debug("wrapping GinModule literal " + literal);
MemberCollector memberCollector = new MemberCollector(GwtTreeLogger.get());
GuiceUtil guiceUtil = new GuiceUtil(memberCollector);
modules.add(new GinModuleAdapter(literal.newInstance(), new GinjectorBindings(null, GwtTreeLogger.get(), guiceUtil, ginectorClass, null, memberCollector, null, null)));
}
return modules;
}
use of com.google.gwt.inject.rebind.util.GuiceUtil in project google-gin by gwtplus.
the class FactoryBindingTest method testDuplicateNamedAssistedAnnotations.
public void testDuplicateNamedAssistedAnnotations() {
try {
new FactoryBinding(Collections.<Key<?>, TypeLiteral<?>>emptyMap(), Key.get(TwoAssistedFooStringsFactory.class), CONTEXT, new GuiceUtil(createInjectableCollector()), null);
fail("Expected ConfigurationException.");
} catch (ConfigurationException e) {
assertTrue(e.getMessage().contains("has more than one parameter of type " + "java.lang.String annotated with @Assisted(\"foo\")."));
}
}
use of com.google.gwt.inject.rebind.util.GuiceUtil in project google-gin by gwtplus.
the class FactoryBindingTest method testMismatchedFactoryAndClassAnnotations.
public void testMismatchedFactoryAndClassAnnotations() {
try {
new FactoryBinding(Collections.<Key<?>, TypeLiteral<?>>emptyMap(), Key.get(MismatchedFactoryAndClassAssistedValuesFactory.class), CONTEXT, new GuiceUtil(createInjectableCollector()), null);
fail("Expected ConfigurationException.");
} catch (ConfigurationException e) {
assertTrue(e.getMessage(), e.getMessage().contains("has no constructors matching " + "the parameters in method"));
}
}
Aggregations