mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-22 02:48:01 +01:00
Count accounts with non-normalized phone numbers
This commit is contained in:
committed by
Jon Chambers
parent
439d2f5df8
commit
3c1705994d
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2013-2021 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.whispersystems.textsecuregcm.storage;
|
||||
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
class NonNormalizedAccountCrawlerListenerTest {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource
|
||||
void hasNumberNormalized(final String number, final boolean expectNormalized) {
|
||||
final Account account = mock(Account.class);
|
||||
when(account.getUuid()).thenReturn(UUID.randomUUID());
|
||||
when(account.getNumber()).thenReturn(number);
|
||||
|
||||
assertEquals(expectNormalized, NonNormalizedAccountCrawlerListener.hasNumberNormalized(account));
|
||||
}
|
||||
|
||||
private static Stream<Arguments> hasNumberNormalized() {
|
||||
return Stream.of(
|
||||
Arguments.of("+447700900111", true),
|
||||
Arguments.of("+4407700900111", false),
|
||||
Arguments.of("Not a real phone number", false),
|
||||
Arguments.of(null, false)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user