Browse Source

Implements Unittest and function to delete credential from arraylist

feature-credentialneu
fdai5728 3 years ago
parent
commit
c5254acda6
  1. 2
      src/main/java/CredentialRepository.java
  2. 13
      src/test/java/CredentialRepositoryTest.java

2
src/main/java/CredentialRepository.java

@ -86,6 +86,8 @@ public class CredentialRepository implements CredentialRepositoryInterface{
@Override @Override
public void delete(int index) { public void delete(int index) {
this.credentials.remove(index);
} }

13
src/test/java/CredentialRepositoryTest.java

@ -70,6 +70,19 @@ class CredentialRepositoryTest {
Credential c = this.credentialRepository.getCredentialsViaId(0); Credential c = this.credentialRepository.getCredentialsViaId(0);
Assertions.assertEquals("newUsername", c.getName()); Assertions.assertEquals("newUsername", c.getName());
}
@Test
void testDeleteEntry(){
this.credentialRepository.createNewCredential("mock", "mock");
this.credentialRepository.delete(0);
Assertions.assertEquals(null, this.credentialRepository.getCredentialsViaId(0));
}
@Test
void testIndexShiftAfterDeletion(){
} }

Loading…
Cancel
Save