private void verifyThatContactWasPersisted(Long id, Contact added) { verify(boundHashOperationsMock, times(1)).put(RedisContactService.HASH_KEY_CONTACT_ID, id); verify(boundHashOperationsMock, times(1)) .put(RedisContactService.HASH_KEY_CONTACT_EMAIL_ADDRESS, added.getEmailAddress()); verify(boundHashOperationsMock, times(1)) .put(RedisContactService.HASH_KEY_CONTACT_FIRST_NAME, added.getFirstName()); verify(boundHashOperationsMock, times(1)) .put(RedisContactService.HASH_KEY_CONTACT_LAST_NAME, added.getLastName()); verify(boundHashOperationsMock, times(1)) .put(RedisContactService.HASH_KEY_CONTACT_PHONE_NUMBER, added.getPhoneNumber()); Address address = added.getAddress(); verify(boundHashOperationsMock, times(1)) .put(RedisContactService.HASH_KEY_ADDRESS_STREET_ADDRESS, address.getStreetAddress()); verify(boundHashOperationsMock, times(1)) .put(RedisContactService.HASH_KEY_ADDRESS_POST_CODE, address.getPostCode()); verify(boundHashOperationsMock, times(1)) .put(RedisContactService.HASH_KEY_ADDRESS_POST_OFFICE, address.getPostOffice()); verify(boundHashOperationsMock, times(1)) .put(RedisContactService.HASH_KEY_ADDRESS_STATE, address.getState()); verify(boundHashOperationsMock, times(1)) .put(RedisContactService.HASH_KEY_ADDRESS_COUNTRY, address.getCountry()); }
private void assertContact(Long expectedId, Contact actual) { assertEquals(expectedId, actual.getId()); assertEquals(ContactTestUtil.EMAIL_ADDRESS, actual.getEmailAddress()); assertEquals(ContactTestUtil.FIRST_NAME, actual.getFirstName()); assertEquals(ContactTestUtil.LAST_NAME, actual.getLastName()); assertEquals(ContactTestUtil.PHONE_NUMBER, actual.getPhoneNumber()); Address actualAddress = actual.getAddress(); assertEquals(ContactTestUtil.STREET_ADDRESS, actualAddress.getStreetAddress()); assertEquals(ContactTestUtil.POST_CODE, actualAddress.getPostCode()); assertEquals(ContactTestUtil.POST_OFFICE, actualAddress.getPostOffice()); assertEquals(ContactTestUtil.STATE, actualAddress.getState()); assertEquals(ContactTestUtil.COUNTRY, actualAddress.getCountry()); }