From bfd8af9c56f95c6061f01f60af1be0bb33f4bb14 Mon Sep 17 00:00:00 2001 From: fdai5728 Date: Wed, 16 Feb 2022 17:34:15 +0100 Subject: [PATCH] Fix counter error in arrayList --- src/main/java/CredentialRepository.java | 2 +- src/test/java/CredentialRepositoryTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/CredentialRepository.java b/src/main/java/CredentialRepository.java index acc0c08..4dd28dd 100644 --- a/src/main/java/CredentialRepository.java +++ b/src/main/java/CredentialRepository.java @@ -2,7 +2,7 @@ import java.util.ArrayList; public class CredentialRepository implements CredentialRepositoryInterface{ - private int idCounter = 1; + private int idCounter = 0; private ArrayList credentials; public CredentialRepository() diff --git a/src/test/java/CredentialRepositoryTest.java b/src/test/java/CredentialRepositoryTest.java index bb10bc6..9159b87 100644 --- a/src/test/java/CredentialRepositoryTest.java +++ b/src/test/java/CredentialRepositoryTest.java @@ -36,7 +36,7 @@ class CredentialRepositoryTest { this.credentialRepository.createNewCredential("mock", "mock"); this.credentialRepository.createNewCredential("kek", "mate"); - Credential c = this.credentialRepository.getCredentialsViaId(2); + Credential c = this.credentialRepository.getCredentialsViaId(1); Assertions.assertEquals("mate", c.getPassword()); }