@Test
  public void testGetCredentialHistory() throws Exception {
    final User createdUser = userDao.add(TestData.User.getTestData(), TestData.User.CREDENTIAL);

    OfBizHelper ofBiz = new OfBizHelper(GenericDelegator.getGenericDelegator("default"));
    ofBiz.createValue(
        UserCredentialHistoryEntity.ENTITY,
        UserCredentialHistoryEntity.getData(((OfBizUser) createdUser).getId(), "secret1", 2));
    ofBiz.createValue(
        UserCredentialHistoryEntity.ENTITY,
        UserCredentialHistoryEntity.getData(((OfBizUser) createdUser).getId(), "secret3", 1));
    ofBiz.createValue(
        UserCredentialHistoryEntity.ENTITY,
        UserCredentialHistoryEntity.getData(((OfBizUser) createdUser).getId(), "secret2", 3));

    final List<PasswordCredential> credentials =
        userDao.getCredentialHistory(TestData.DIRECTORY_ID, TestData.User.NAME);

    assertEquals(3, credentials.size());

    assertEquals(
        Arrays.asList(
            new PasswordCredential("secret3", true),
            new PasswordCredential("secret1", true),
            new PasswordCredential("secret2", true)),
        credentials);
  }
 /** Constructor */
 public RewardTypeDataServiceImpl() {
   this.delegator = GenericDelegator.getGenericDelegator("default");
 }