Browse Source

Implements Unittest and function to delete credential from arraylist

feature-serializer
fdai5728 3 years ago
committed by fdai6352
parent
commit
57ae190c63
  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