mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 17:48:04 +01:00
Extract "is ported" data from HLR Lookup responses
This commit is contained in:
committed by
ravi-signal
parent
ff8194ae5f
commit
c0d0d5f5da
@@ -110,8 +110,7 @@ class HlrLookupCarrierDataProviderTest {
|
||||
final Optional<CarrierData> maybeCarrierData =
|
||||
hlrLookupCarrierDataProvider.lookupCarrierData(PhoneNumberUtil.getInstance().getExampleNumber("US"), Duration.ZERO);
|
||||
|
||||
assertEquals(Optional.of(new CarrierData("Virgin Mobile", CarrierData.LineType.MOBILE, Optional.of("234"), Optional.of("38"),
|
||||
Optional.empty())),
|
||||
assertEquals(Optional.of(new CarrierData("Virgin Mobile", CarrierData.LineType.MOBILE, Optional.of("234"), Optional.of("38"), Optional.of(true))),
|
||||
maybeCarrierData);
|
||||
}
|
||||
|
||||
@@ -220,6 +219,25 @@ class HlrLookupCarrierDataProviderTest {
|
||||
);
|
||||
}
|
||||
|
||||
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
|
||||
@ParameterizedTest
|
||||
@MethodSource
|
||||
void isPorted(final String isPortedString, final Optional<Boolean> expectedIsPortedValue) {
|
||||
final HlrLookupResult hlrLookupResult =
|
||||
new HlrLookupResult("NONE", "NOT_AVAILABLE", null, "NOT_AVAILABLE", null, "MOBILE", isPortedString);
|
||||
|
||||
assertEquals(expectedIsPortedValue, HlrLookupCarrierDataProvider.isPorted(hlrLookupResult.isPorted()));
|
||||
}
|
||||
|
||||
private static List<Arguments> isPorted() {
|
||||
return List.of(
|
||||
Arguments.argumentSet("Null isPorted string", null, Optional.empty()),
|
||||
Arguments.argumentSet("Is ported", "YES", Optional.of(true)),
|
||||
Arguments.argumentSet("Is not ported", "NO", Optional.of(false)),
|
||||
Arguments.argumentSet("Unrecognized isPorted string", "UNKNOWN", Optional.empty())
|
||||
);
|
||||
}
|
||||
|
||||
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
|
||||
@ParameterizedTest
|
||||
@MethodSource
|
||||
@@ -272,7 +290,8 @@ class HlrLookupCarrierDataProviderTest {
|
||||
originalNetwork,
|
||||
currentNetwork == null ? "NOT_AVAILABLE" : "AVAILABLE",
|
||||
currentNetwork,
|
||||
"MOBILE");
|
||||
"MOBILE",
|
||||
"NO");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user