mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-11-30 01:16:50 +00:00
Avoid calling method when mocking a stub from another class
This commit is contained in:
1 parent
edce40958b
commit
d99515e31e
1 file changed
+5
-1
+5
-1
@@ -12,6 +12,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.doThrow;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
@@ -510,7 +511,10 @@ class AccountControllerV2Test {
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(AccountsTestHelper.AccountsDataReportArgumentProvider.class)
|
||||
void testGetAccountDataReport(final Account account, final String expectedTextAfterHeader) throws Exception {
|
||||
when(AuthHelper.ACCOUNTS_MANAGER.getByAccountIdentifier(account.getAccountIdentifier())).thenReturn(Optional.of(account));
|
||||
// Use doReturn when mocking a stub from another class
|
||||
doReturn(Optional.of(account))
|
||||
.when(AuthHelper.ACCOUNTS_MANAGER)
|
||||
.getByAccountIdentifier(account.getAccountIdentifier());
|
||||
when(accountsManager.getByAccountIdentifier(account.getAccountIdentifier())).thenReturn(Optional.of(account));
|
||||
|
||||
final Response response = resources.getJerseyTest()
|
||||
|
||||
Reference in new issue
Block a user