diff --git a/src/main/java/CredentialRepository.java b/src/main/java/CredentialRepository.java index 1a5a6b5..f8f66f3 100644 --- a/src/main/java/CredentialRepository.java +++ b/src/main/java/CredentialRepository.java @@ -33,8 +33,19 @@ public class CredentialRepository implements CredentialRepositoryInterface{ } + public Credential getCredentialsViaName(String needle) { + + for(int c = 0; c < this.getListSize(); c++) + { + + } + + return null; + } + + @Override - public void getCredentials() { + public void getCredentialsViaId() { } diff --git a/src/main/java/CredentialRepositoryInterface.java b/src/main/java/CredentialRepositoryInterface.java index 7730f2d..de543eb 100644 --- a/src/main/java/CredentialRepositoryInterface.java +++ b/src/main/java/CredentialRepositoryInterface.java @@ -3,7 +3,8 @@ public interface CredentialRepositoryInterface { int createNewCredential(String name, String password); void edit(); void delete(); - void getCredentials(); + void getCredentialsViaName(); + void getCredentialsViaId(); void setCredentials(); void getAsJSON(); void loadCredentialsFromJSON(); diff --git a/src/test/java/CredentialRepositoryTest.java b/src/test/java/CredentialRepositoryTest.java index d3a6f67..36fe139 100644 --- a/src/test/java/CredentialRepositoryTest.java +++ b/src/test/java/CredentialRepositoryTest.java @@ -20,6 +20,17 @@ class CredentialRepositoryTest { Assertions.assertEquals(2, this.credentialRepository.createNewCredential("kek", "mate")); } + @Test + void searchForUserInRepository() { + + this.credentialRepository.createNewCredential("mock", "mock"); + this.credentialRepository.createNewCredential("kek", "mate"); + + Credential c = this.credentialRepository.getCredentialsViaName("kek"); + Assertions.assertEquals("mate", c.getPassword()); + } + + }