@Test
  public void testFindUserSettings2() throws Exception {

    when(userSettingRepository.findByUser(this.user))
        .thenReturn(Lists.newArrayList(new UserSetting("key", "value", this.user)));

    final Map<String, String> userSettings = service.findUserSettings();
    assertThat(userSettings.size(), is(1));

    assertThat(userSettings.containsKey("key"), is(true));
    assertThat(userSettings.get("key"), is("value"));
  }
  @Test
  public void testCreateOrUpdateSetting() throws Exception {

    when(userSettingRepository.findByKeyAndUser("hello", this.user)).thenReturn(null);

    service.createOrUpdateSetting("hello", "world");

    InOrder order = inOrder(doxUserRepository, userSettingRepository);

    order.verify(doxUserRepository).findByUsername("username");
    // has no ID yet. wont pass equals test
    order.verify(userSettingRepository).save(any(UserSetting.class));
    order.verifyNoMoreInteractions();
  }