@Test(expected = NotFoundException.class)
  public void findByIdWhenContactIsNotFound() throws NotFoundException {
    when(redisTemplateMock.opsForSet()).thenReturn(setOperationsMock);
    when(setOperationsMock.isMember(RedisContactService.KEY_CONTACT_SET, CONTACT_KEY))
        .thenReturn(false);

    service.findById(CONTACT_ID);

    verifyThatExistCheckForContactIsDone(CONTACT_KEY);

    verifyNoMoreInteractions(redisTemplateMock, setOperationsMock);
    verifyZeroInteractions(boundHashOperationsMock, contactIdCounterMock);
  }
  @Test
  public void findById() throws NotFoundException {
    when(redisTemplateMock.boundHashOps(CONTACT_KEY)).thenReturn(boundHashOperationsMock);
    when(redisTemplateMock.opsForSet()).thenReturn(setOperationsMock);
    when(setOperationsMock.isMember(RedisContactService.KEY_CONTACT_SET, CONTACT_KEY))
        .thenReturn(true);
    initGetHashOperationsForContact(CONTACT_ID);

    Contact found = service.findById(CONTACT_ID);

    verify(redisTemplateMock, times(1)).boundHashOps(CONTACT_KEY);

    verifyThatExistCheckForContactIsDone(CONTACT_KEY);
    verifyThatContactWasGet();

    verifyNoMoreInteractions(boundHashOperationsMock, redisTemplateMock, setOperationsMock);
    verifyZeroInteractions(contactIdCounterMock);

    assertContact(CONTACT_ID, found);
  }