use of dagger.internal.TestingLoader in project dagger by square.
the class UnusedProviderTest method unusedSetBinding.
@Test
public void unusedSetBinding() throws Exception {
@Module
class TestModule {
@Provides(type = Provides.Type.SET)
String provideA() {
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 LazyInjectionTest method getLazyDoesNotCauseInjectedTypesToBeLoaded.
@Test
public void getLazyDoesNotCauseInjectedTypesToBeLoaded() {
@Module(injects = LazyEntryPoint.class)
class TestModule {
}
ObjectGraph.createWith(new TestingLoader(), new TestModule());
assertThat(lazyEntryPointLoaded).isFalse();
}
use of dagger.internal.TestingLoader in project dagger by square.
the class MembersInjectorTest method instanceInjectionOfNonStaticInnerFailsEarly.
@Test
public void instanceInjectionOfNonStaticInnerFailsEarly() {
class TestEntryPoint {
@Inject
NonStaticInner nonStaticInner;
}
@Module(injects = TestEntryPoint.class)
class TestModule {
}
ObjectGraph graph = ObjectGraph.createWith(new TestingLoader(), new TestModule());
try {
graph.get(TestEntryPoint.class);
fail();
} catch (IllegalStateException expected) {
}
}
use of dagger.internal.TestingLoader in project dagger by square.
the class MembersInjectorTest method injectionOfUnconstructableFails.
@Test
public void injectionOfUnconstructableFails() {
class TestEntryPoint {
@Inject
Unconstructable unconstructable;
}
@Module(injects = TestEntryPoint.class)
class TestModule {
}
ObjectGraph graph = ObjectGraph.createWith(new TestingLoader(), new TestModule());
try {
graph.get(TestEntryPoint.class);
fail();
} catch (IllegalStateException expected) {
}
}
use of dagger.internal.TestingLoader in project dagger by square.
the class MembersInjectorTest method rejectUnconstructableSingleton.
@Test
public void rejectUnconstructableSingleton() {
class TestEntryPoint {
@Inject
MembersInjector<UnconstructableSingleton> membersInjector;
}
@Module(injects = TestEntryPoint.class)
class TestModule {
}
ObjectGraph graph = ObjectGraph.createWith(new TestingLoader(), new TestModule());
try {
graph.get(TestEntryPoint.class);
fail();
} catch (IllegalStateException expected) {
}
}
Aggregations