Handle ACCOUNT_NOT_FOUND errors in AppleAppStoreClient

This commit is contained in:
Ravi Khadiwala authored and Chris Eager committed 2026-06-29 13:11:00 -05:00
1 parent 355b320c92
commit f588390bdb
2 files changed
+16 -2

No files matched your search

@@ -6,6 +6,7 @@ package org.whispersystems.textsecuregcm.subscriptions;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatException;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.times;
@@ -63,6 +64,19 @@ class AppleAppStoreClientTest {
verifyNoInteractions(sandboxClient);
}
@ParameterizedTest
@EnumSource(mode = EnumSource.Mode.INCLUDE, names = {"TRANSACTION_ID_NOT_FOUND", "ORIGINAL_TRANSACTION_ID_NOT_FOUND", "ACCOUNT_NOT_FOUND"})
public void notFound(APIError error) throws APIException, IOException {
when(productionClient.getAllSubscriptionStatuses(ORIGINAL_TX_ID, new Status[]{}))
.thenThrow(new APIException(404, error, "test"));
when(sandboxClient.getAllSubscriptionStatuses(ORIGINAL_TX_ID, new Status[]{}))
.thenThrow(new APIException(404, error, "test"));
assertThatExceptionOfType(SubscriptionNotFoundException.class)
.isThrownBy(() -> apiWrapper.getAllSubscriptions(ORIGINAL_TX_ID, Tags.empty()));
}
@Test
public void fallbackOnNoTransactionFound()
throws APIException, IOException, SubscriptionInvalidArgumentsException, SubscriptionNotFoundException, RateLimitExceededException {