Browse Source

Fix counter error in arrayList

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

2
src/main/java/CredentialRepository.java

@ -2,7 +2,7 @@ import java.util.ArrayList;
public class CredentialRepository implements CredentialRepositoryInterface{ public class CredentialRepository implements CredentialRepositoryInterface{
private int idCounter = 1;
private int idCounter = 0;
private ArrayList<Credential> credentials; private ArrayList<Credential> credentials;
public CredentialRepository() public CredentialRepository()

2
src/test/java/CredentialRepositoryTest.java

@ -36,7 +36,7 @@ class CredentialRepositoryTest {
this.credentialRepository.createNewCredential("mock", "mock"); this.credentialRepository.createNewCredential("mock", "mock");
this.credentialRepository.createNewCredential("kek", "mate"); this.credentialRepository.createNewCredential("kek", "mate");
Credential c = this.credentialRepository.getCredentialsViaId(2);
Credential c = this.credentialRepository.getCredentialsViaId(1);
Assertions.assertEquals("mate", c.getPassword()); Assertions.assertEquals("mate", c.getPassword());
} }

Loading…
Cancel
Save