when(entry.getAttributes()).thenReturn(attributes);
when(entry.getId()).thenReturn(id);
TrustStoreRecoverer recoverer = new TrustStoreRecoverer();
TrustStore trustStore = recoverer.create(null, entry, broker);
assertNotNull("Trust store configured object is not created", trustStore);
assertEquals(id, trustStore.getId());
//verify we can retrieve the actual password using the method
assertEquals(TestSSLConstants.BROKER_TRUSTSTORE_PASSWORD, trustStore.getPassword());
assertNotNull(trustStore.getPassword());
//verify that we havent configured the trust store with the actual dummy password value
assertFalse(AbstractKeyStoreAdapter.DUMMY_PASSWORD_MASK.equals(trustStore.getPassword()));
// Verify the remaining attributes, including that the password value returned
// via getAttribute is actually the dummy value and not the real password
attributesCopy.put(TrustStore.PASSWORD, AbstractKeyStoreAdapter.DUMMY_PASSWORD_MASK);
for (Map.Entry<String, Object> attribute : attributesCopy.entrySet())
{
Object attributeValue = trustStore.getAttribute(attribute.getKey());
assertEquals("Unexpected value of attribute '" + attribute.getKey() + "'", attribute.getValue(), attributeValue);
}
}