Browse Source

Implements test for search function over repository

feature-serializer
fdai5728 3 years ago
committed by fdai6352
parent
commit
aff9a8f70e
  1. 13
      src/main/java/CredentialRepository.java
  2. 3
      src/main/java/CredentialRepositoryInterface.java
  3. 11
      src/test/java/CredentialRepositoryTest.java

13
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() {
}

3
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();

11
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());
}
}

Loading…
Cancel
Save