|
@ -9,6 +9,8 @@ import org.mockito.InOrder; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.Date; |
|
|
import java.util.Date; |
|
|
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.AssertionsForClassTypes.assertThat; |
|
|
|
|
|
import static org.hamcrest.CoreMatchers.is; |
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
import static org.mockito.ArgumentMatchers.anyString; |
|
|
import static org.mockito.ArgumentMatchers.anyString; |
|
|
import static org.mockito.Mockito.*; |
|
|
import static org.mockito.Mockito.*; |
|
@ -123,4 +125,16 @@ public class AccountServiceTest { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
public void verifyCreateAccount() { |
|
|
|
|
|
|
|
|
|
|
|
when(accountRepository.save(any(Account.class))).thenReturn(true); |
|
|
|
|
|
|
|
|
|
|
|
assertTrue(accountService.createAccount("John", "pwd", Account.AccountStatus.ACTIVE)); |
|
|
|
|
|
|
|
|
|
|
|
verify(accountRepository).save(any(Account.class)); |
|
|
|
|
|
verify(accountRepository, times(1)).checkIfAccountAlreadyExist(any(Account.class)); |
|
|
|
|
|
verify(accountRepository, never()).delete(any(Account.class)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |