diff --git a/src/main/java/dev/justgiulio/passwordmanager/controller/AccountController.java b/src/main/java/dev/justgiulio/passwordmanager/controller/AccountController.java index f0a7b82..ed382b0 100644 --- a/src/main/java/dev/justgiulio/passwordmanager/controller/AccountController.java +++ b/src/main/java/dev/justgiulio/passwordmanager/controller/AccountController.java @@ -59,7 +59,7 @@ public void modifyPassword(Account alreadySavedAccount, String newCredentialPass accountRepository.save(new Account(alreadySavedAccount.getSite(), new Credential(alreadySavedAccount.getCredential().getUsername(), newCredentialPassword))); accountView.accountIsModified(); }else { - accountView.showError("Can't find any account for selected site with specified username"); + accountView.showAccountRelatedError("Can't find any account for selected site with specified password"); } } @@ -71,7 +71,7 @@ public void modifyUsername(Account alreadySavedAccount, String newCredentialUser accountRepository.save(new Account(alreadySavedAccount.getSite(), new Credential(newCredentialUsername,alreadySavedAccount.getCredential().getPassword()))); accountView.accountIsModified(); }else { - accountView.showError("Can't find any account for selected site with specified username"); + accountView.showAccountRelatedError("Can't find any account for selected site with specified username"); } } @@ -81,7 +81,7 @@ public void delete(Account accountToDelete) { accountRepository.delete(accountToDelete); accountView.accountIsDeleted(); }else { - accountView.showError("Can't find any account for selected site"); + accountView.showAccountRelatedError("Can't find any account for selected site"); } } diff --git a/src/test/java/dev/justgiulio/passwordmanager/controller/AccountControllerTest.java b/src/test/java/dev/justgiulio/passwordmanager/controller/AccountControllerTest.java index 99d2660..303aa95 100644 --- a/src/test/java/dev/justgiulio/passwordmanager/controller/AccountControllerTest.java +++ b/src/test/java/dev/justgiulio/passwordmanager/controller/AccountControllerTest.java @@ -142,7 +142,7 @@ public void modifyAccountPasswordWhenAccountDoesntExistsNotOperationPerfomedTest String newCredentialPassword = "passMoreSecure123"; when(accountRepository.findByKey(site)).thenReturn(Arrays.asList(new Account("github.com", new Credential("remegiulio","remepassword")))); controller.modifyPassword(new Account("github.com", new Credential("giulio","passgiulio")), newCredentialPassword); - verify(accountView).showError("Can't find any account for selected site with specified username"); + verify(accountView).showAccountRelatedError("Can't find any account for selected site with specified password"); verifyNoMoreInteractions(ignoreStubs(accountRepository)); } @@ -152,7 +152,7 @@ public void modifyAccountUsernameWhenAccountDoesntExistsNotOperationPerfomedTest String newCredentialUsername = "remeic"; when(accountRepository.findByKey(site)).thenReturn(Arrays.asList(new Account("github.com", new Credential("remegiulio","remepassword")))); controller.modifyUsername(new Account("github.com", new Credential("giulio","passgiulio")), newCredentialUsername); - verify(accountView).showError("Can't find any account for selected site with specified username"); + verify(accountView).showAccountRelatedError("Can't find any account for selected site with specified username"); verifyNoMoreInteractions(ignoreStubs(accountRepository)); } @@ -173,7 +173,7 @@ public void deleteAccountNotExistsNoPerformOperationTest() { Account accountToDelete = new Account("github.com", new Credential("remegiulio","remepassword")); when(accountRepository.findByKey(site)).thenReturn(Arrays.asList(accountToDelete)); controller.delete( new Account("github.com", new Credential("giulio","remepassword"))); - verify(accountView).showError("Can't find any account for selected site"); + verify(accountView).showAccountRelatedError("Can't find any account for selected site"); verifyNoMoreInteractions(ignoreStubs(accountRepository)); }