@Test(expected = CredentialManagerException.class) public void getUnknownKey() throws CredentialManagerException { @SuppressWarnings("unused") SecretKey storedInspectorSecretKey = credMng.getInspectorSecretKey(URI.create(UUID.randomUUID().toString())); // We should not get here. assertFalse(true); }
@Test public void storeKey() throws Exception { SecretKey inspectorSecretKey = new SecretKey(); CryptoParams cryptoParams = new CryptoParams(); cryptoParams.getContent().add("TestString1"); inspectorSecretKey.setCryptoParams(cryptoParams); credMng.storeInspectorSecretKey(EXPECTED_UUID, inspectorSecretKey); SecretKey storedInspectorSecretKey = credMng.getInspectorSecretKey(EXPECTED_UUID); assertEquals( inspectorSecretKey.getCryptoParams().getContent().get(0), storedInspectorSecretKey.getCryptoParams().getContent().get(0)); }