mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-22 00:18:06 +01:00
Don’t throw exceptions from ReportMessageManager#store()
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package org.whispersystems.textsecuregcm.storage;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.doThrow;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import io.micrometer.core.instrument.Counter;
|
||||
@@ -26,11 +28,18 @@ class ReportMessageManagerTest {
|
||||
final UUID messageGuid = UUID.randomUUID();
|
||||
final String number = "+15105551111";
|
||||
|
||||
assertThrows(NullPointerException.class, () -> reportMessageManager.store(null, messageGuid));
|
||||
assertDoesNotThrow(() -> reportMessageManager.store(null, messageGuid));
|
||||
|
||||
verifyZeroInteractions(reportMessageDynamoDb);
|
||||
|
||||
reportMessageManager.store(number, messageGuid);
|
||||
|
||||
verify(reportMessageDynamoDb).store(any());
|
||||
|
||||
doThrow(RuntimeException.class)
|
||||
.when(reportMessageDynamoDb).store(any());
|
||||
|
||||
assertDoesNotThrow(() -> reportMessageManager.store(number, messageGuid));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user