@Test
public void listSecretVersions() {

  SanitizedSecret secret1 = SanitizedSecret.of(1, "name1", "desc", "checksum", NOW, "user",
      NOW, "user", emptyMap, null, null, 1136214245, 125L, NOW, "user");
  SanitizedSecret secret2 = SanitizedSecret.of(1, "name1", "desc", "checksum2", NOWPLUS, "user",
      NOWPLUS, "user", emptyMap, null, null, 1136214245, 250L, NOW, "user");
  when(secretDAO.getSecretVersionsByName("name1", 0, 10)).thenReturn(
      Optional.of(ImmutableList.of(secret2, secret1)));
  when(secretDAO.getSecretVersionsByName("name1", 1, 5)).thenReturn(
      Optional.of(ImmutableList.of(secret1)));
  when(secretDAO.getSecretVersionsByName("name1", 2, 10)).thenReturn(
      Optional.of(ImmutableList.of()));
  List<SanitizedSecret> response = resource.secretVersions(user, "name1", 0, 10);
  assertThat(response).containsExactly(secret2, secret1);
  response = resource.secretVersions(user, "name1", 1, 5);
  assertThat(response).containsExactly(secret1);
  response = resource.secretVersions(user, "name1", 2, 10);
  assertThat(response).isEmpty();
}