use of dagger.ObjectGraph in project Signal-Android by WhisperSystems.
the class DeliveryReceiptJobTest method testNetworkError.
@Test
public void testNetworkError() throws IOException {
SignalServiceMessageSender textSecureMessageSender = mock(SignalServiceMessageSender.class);
long timestamp = System.currentTimeMillis();
Mockito.doThrow(new PushNetworkException("network error")).when(textSecureMessageSender).sendDeliveryReceipt(any(SignalServiceAddress.class), eq(timestamp));
DeliveryReceiptJob deliveryReceiptJob = new DeliveryReceiptJob(context, "+14152222222", timestamp, "foo");
ObjectGraph objectGraph = ObjectGraph.create(new TestModule(textSecureMessageSender));
objectGraph.inject(deliveryReceiptJob);
try {
deliveryReceiptJob.onRun();
throw new AssertionError();
} catch (IOException e) {
assertTrue(deliveryReceiptJob.onShouldRetry(e));
}
Mockito.doThrow(new NotFoundException("not found")).when(textSecureMessageSender).sendDeliveryReceipt(any(SignalServiceAddress.class), eq(timestamp));
try {
deliveryReceiptJob.onRun();
throw new AssertionError();
} catch (IOException e) {
assertFalse(deliveryReceiptJob.onShouldRetry(e));
}
}
use of dagger.ObjectGraph in project Signal-Android by WhisperSystems.
the class DeliveryReceiptJobTest method testDelivery.
@Test
public void testDelivery() throws IOException {
SignalServiceMessageSender textSecureMessageSender = mock(SignalServiceMessageSender.class);
long timestamp = System.currentTimeMillis();
DeliveryReceiptJob deliveryReceiptJob = new DeliveryReceiptJob(context, "+14152222222", timestamp, "foo");
ObjectGraph objectGraph = ObjectGraph.create(new TestModule(textSecureMessageSender));
objectGraph.inject(deliveryReceiptJob);
deliveryReceiptJob.onRun();
ArgumentCaptor<SignalServiceAddress> captor = ArgumentCaptor.forClass(SignalServiceAddress.class);
verify(textSecureMessageSender).sendDeliveryReceipt(captor.capture(), eq(timestamp));
assertTrue(captor.getValue().getRelay().get().equals("foo"));
assertTrue(captor.getValue().getNumber().equals("+14152222222"));
}
use of dagger.ObjectGraph in project Rutgers-Course-Tracker by tevjef.
the class SectionInfoPresenterImplTest method setUp.
@Before
public void setUp() throws Exception {
ObjectGraph og = ObjectGraph.create(new TestModule(), new MockModule());
og.inject(this);
sectioninfoPresenterImpl = new SectionInfoPresenterImpl(section);
og.inject(sectioninfoPresenterImpl);
}
use of dagger.ObjectGraph in project Rutgers-Course-Tracker by tevjef.
the class RetroRutgersTest method setUp.
@Before
public void setUp() throws Exception {
ObjectGraph og = ObjectGraph.create(new TestModule());
og.inject(this);
retroRutgers = new RetroRutgers(rutgersService, backgroundThread);
}
use of dagger.ObjectGraph in project Rutgers-Course-Tracker by tevjef.
the class ChooserPresenterImplTest method setUp.
@Before
public void setUp() throws Exception {
ObjectGraph og = ObjectGraph.create(new TestModule(), new MockModule());
og.inject(this);
chooserPresenterImpl = new ChooserPresenterImpl();
og.inject(chooserPresenterImpl);
}
Aggregations