use of dagger.internal.TestingLoader in project dagger by square.
the class InjectionTest method nonEntryPointNeedsInjectAnnotation.
@Test
public void nonEntryPointNeedsInjectAnnotation() {
@Module
class TestModule {
@Provides
String provideString(NoInjections noInjections) {
throw new AssertionError();
}
}
ObjectGraph graph = ObjectGraph.createWith(new TestingLoader(), new TestModule());
try {
graph.validate();
fail();
} catch (IllegalStateException expected) {
}
}
use of dagger.internal.TestingLoader in project dagger by square.
the class InjectionTest method providesSetConflictsWithProvidesTypeSetValues.
@Test
public void providesSetConflictsWithProvidesTypeSetValues() {
@Module
class TestModule {
@Provides(type = Provides.Type.SET_VALUES)
Set<A> provideSetContribution() {
throw new AssertionError();
}
@Provides
Set<A> provideSet() {
throw new AssertionError();
}
}
try {
ObjectGraph.createWith(new TestingLoader(), new TestModule());
fail();
} catch (IllegalArgumentException expected) {
}
}
use of dagger.internal.TestingLoader in project dagger by square.
the class InjectionTest method atInjectAlwaysRequiredForConstruction.
/** https://github.com/square/dagger/issues/231 */
@Test
public void atInjectAlwaysRequiredForConstruction() {
@Module(injects = ArrayList.class)
class TestModule {
}
ObjectGraph objectGraph = ObjectGraph.createWith(new TestingLoader(), new TestModule());
objectGraph.validate();
try {
objectGraph.get(ArrayList.class);
fail();
} catch (IllegalStateException e) {
assertThat(e.getMessage()).contains("Unable to create binding for java.util.ArrayList");
}
}
use of dagger.internal.TestingLoader in project dagger by square.
the class InjectionTest method providesSetConflictsWithProvidesTypeSet.
@Test
public void providesSetConflictsWithProvidesTypeSet() {
@Module
class TestModule {
@Provides(type = Provides.Type.SET)
A provideSetElement() {
throw new AssertionError();
}
@Provides
Set<A> provideSet() {
throw new AssertionError();
}
}
try {
ObjectGraph.createWith(new TestingLoader(), new TestModule());
fail();
} catch (IllegalArgumentException expected) {
}
}
use of dagger.internal.TestingLoader in project dagger by square.
the class InjectionTest method noJitBindingsForInterfaces.
@Test
public void noJitBindingsForInterfaces() {
class TestEntryPoint {
@Inject
RandomAccess randomAccess;
}
@Module(injects = TestEntryPoint.class)
class TestModule {
}
ObjectGraph graph = ObjectGraph.createWith(new TestingLoader(), new TestModule());
try {
graph.validate();
fail();
} catch (IllegalStateException expected) {
}
}
Aggregations