|
@ -86,8 +86,34 @@ class CredentialRepositoryTest { |
|
|
|
|
|
|
|
|
this.credentialRepository.createNewCredential("mock", "mock"); |
|
|
this.credentialRepository.createNewCredential("mock", "mock"); |
|
|
this.credentialRepository.serializeObject("testName"); |
|
|
this.credentialRepository.serializeObject("testName"); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void testLoadingOfSerializedObject(){ |
|
|
|
|
|
|
|
|
|
|
|
this.credentialRepository.createNewCredential("mock1", "mock1"); |
|
|
|
|
|
this.credentialRepository.createNewCredential("mock2", "mock2"); |
|
|
|
|
|
this.credentialRepository.createNewCredential("mock3", "mock3"); |
|
|
|
|
|
|
|
|
|
|
|
Credential temporary1 = this.credentialRepository.getCredentialsViaId(0); |
|
|
|
|
|
Credential temporary2 = this.credentialRepository.getCredentialsViaId(1); |
|
|
|
|
|
Credential temporary3 = this.credentialRepository.getCredentialsViaId(2); |
|
|
|
|
|
|
|
|
|
|
|
this.credentialRepository.serializeObject("unitTest_Deserialization"); |
|
|
|
|
|
|
|
|
|
|
|
//delete entries to proove we really load something |
|
|
|
|
|
this.credentialRepository.delete(0); |
|
|
|
|
|
this.credentialRepository.delete(0); |
|
|
|
|
|
Assertions.assertEquals(null, this.credentialRepository.getCredentialsViaName("mock2") ); |
|
|
|
|
|
|
|
|
|
|
|
//load and deserialize object and proove objects are back |
|
|
|
|
|
this.credentialRepository.deserializeObjects("unitTest_Deserialization"); |
|
|
|
|
|
Assertions.assertEquals(temporary1.getName(), this.credentialRepository.getCredentialsViaName("mock1").getName()); |
|
|
|
|
|
Assertions.assertEquals(temporary1.getPassword(), this.credentialRepository.getCredentialsViaName("mock1").getPassword()); |
|
|
|
|
|
Assertions.assertEquals(temporary2.getName(), this.credentialRepository.getCredentialsViaName("mock2").getName()); |
|
|
|
|
|
Assertions.assertEquals(temporary2.getPassword(), this.credentialRepository.getCredentialsViaName("mock2").getPassword()); |
|
|
|
|
|
Assertions.assertEquals(temporary3.getName(), this.credentialRepository.getCredentialsViaName("mock3").getName()); |
|
|
|
|
|
Assertions.assertEquals(temporary3.getPassword(), this.credentialRepository.getCredentialsViaName("mock3").getPassword()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |