From e09a9c17079011e73520c5d1ae7ade85a250d722 Mon Sep 17 00:00:00 2001 From: Katherine Yen Date: Wed, 12 Aug 2026 15:40:47 -0400 Subject: [PATCH] Parameterize `AccountsManagerTest#testUpdateDevice` with numberless variant --- .../textsecuregcm/storage/AccountsManagerTest.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerTest.java index 9b79924b6..4c296e8d9 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerTest.java @@ -708,10 +708,13 @@ class AccountsManagerTest { verifyNoMoreInteractions(accounts); } - @Test - void testUpdateDevice() { + @ParameterizedTest + @ValueSource(booleans = {true, false}) + void testUpdateDevice(final boolean numberless) { final UUID uuid = UUID.randomUUID(); - Account account = AccountsHelper.generateTestAccount("+14152222222", uuid, UUID.randomUUID(), new ArrayList<>(), new byte[UnidentifiedAccessUtil.UNIDENTIFIED_ACCESS_KEY_LENGTH]); + Account account = numberless + ? AccountsHelper.generateTestAccount(null, uuid, null, new ArrayList<>(), new byte[UnidentifiedAccessUtil.UNIDENTIFIED_ACCESS_KEY_LENGTH]) + : AccountsHelper.generateTestAccount("+14152222222", uuid, UUID.randomUUID(), new ArrayList<>(), new byte[UnidentifiedAccessUtil.UNIDENTIFIED_ACCESS_KEY_LENGTH]); addRetrievableAccount(account); assertTrue(account.getDevices().isEmpty()); @@ -726,7 +729,7 @@ class AccountsManagerTest { @SuppressWarnings("unchecked") Consumer deviceUpdater = mock(Consumer.class); @SuppressWarnings("unchecked") Consumer unknownDeviceUpdater = mock(Consumer.class); - account = accountsManager.updateDevice(uuid, deviceId, deviceUpdater); + accountsManager.updateDevice(uuid, deviceId, deviceUpdater); account = accountsManager.updateDevice(uuid, deviceId, d -> d.setName("deviceName".getBytes(StandardCharsets.UTF_8))); assertArrayEquals("deviceName".getBytes(StandardCharsets.UTF_8), account.getDevice(deviceId).orElseThrow().getName());