@Test public void givenKnownPopulatedAttributesOfObjectWhenCallingEncryptAnnotatedMethodThenAllOfTheObjectAttributesMustBeEncrypted() { long startTime = System.currentTimeMillis(); Account expected = integrationTest.encryptMeWithSpecifiedAttributes(EXPECTED_ACCOUNT); LOGGER.debug("Encryption took: " + (System.currentTimeMillis() - startTime) + " ms"); assertTrue(expected.getId().equals(EXPECTED_ID)); assertFalse(expected.getName().equals(EXPECTED_NAME)); assertFalse(expected.getAddress().equals(EXPECTED_ADDRESS)); }
@Test public void givenKnownEncryptedObjectWhenCallingDecryptAnnotatedMethodThenAllOfTheObjectAttributesMustBePlainText() { long startTime = System.currentTimeMillis(); Account expected = integrationTest.encryptMe(EXPECTED_ACCOUNT); LOGGER.debug("Decryption took: " + (System.currentTimeMillis() - startTime) + " ms"); LOGGER.debug("Expected: " + expected); expected = integrationTest.decryptMe(expected); assertTrue(expected.getId().equals(EXPECTED_ID)); assertTrue(expected.getName().equals(EXPECTED_NAME)); assertTrue(expected.getAddress().equals(EXPECTED_ADDRESS)); }
@Before public void setUp() { EXPECTED_ACCOUNT = new Account(EXPECTED_ID, EXPECTED_NAME); EXPECTED_ACCOUNT.setAddress(EXPECTED_ADDRESS); }