use of org.whispersystems.signalservice.api.subscriptions.SubscriberId in project Signal-Android by WhisperSystems.
the class DonationsServiceTest method givenASubscriberId_whenIGetAnUnsuccessfulResponse_thenItIsMappedWithTheCorrectStatusCodeAndEmptyObject.
@Test
public void givenASubscriberId_whenIGetAnUnsuccessfulResponse_thenItIsMappedWithTheCorrectStatusCodeAndEmptyObject() throws Exception {
// GIVEN
SubscriberId subscriberId = SubscriberId.generate();
when(pushServiceSocket.getSubscription(subscriberId.serialize())).thenThrow(new NonSuccessfulResponseCodeException(403));
// WHEN
TestObserver<ServiceResponse<ActiveSubscription>> testObserver = testSubject.getSubscription(subscriberId).test();
// THEN
TEST_SCHEDULER.triggerActions();
verify(pushServiceSocket).getSubscription(subscriberId.serialize());
testObserver.assertComplete().assertValue(value -> value.getStatus() == 403 && !value.getResult().isPresent());
}
use of org.whispersystems.signalservice.api.subscriptions.SubscriberId in project Signal-Android by WhisperSystems.
the class DonationsServiceTest method givenASubscriberId_whenIGetASuccessfulResponse_thenItIsMappedWithTheCorrectStatusCodeAndNonEmptyObject.
@Test
public void givenASubscriberId_whenIGetASuccessfulResponse_thenItIsMappedWithTheCorrectStatusCodeAndNonEmptyObject() throws Exception {
// GIVEN
SubscriberId subscriberId = SubscriberId.generate();
when(pushServiceSocket.getSubscription(subscriberId.serialize())).thenReturn(getActiveSubscription());
// WHEN
TestObserver<ServiceResponse<ActiveSubscription>> testObserver = testSubject.getSubscription(subscriberId).test();
// THEN
TEST_SCHEDULER.triggerActions();
verify(pushServiceSocket).getSubscription(subscriberId.serialize());
testObserver.assertComplete().assertValue(value -> value.getStatus() == 200 && value.getResult().isPresent());
}
Aggregations