Skip to content

Commit

Permalink
Merge pull request #119 from manishdait/issue-106
Browse files Browse the repository at this point in the history
Implement tests for getExpirationTime() to cover null and invalid file Id
  • Loading branch information
hendrikebbers authored Dec 3, 2024
2 parents 189c12a + 7749ff3 commit 0d762a5
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ void testNullParams() {
Assertions.assertThrows(NullPointerException.class, () -> fileClient.readFile((FileId) null));
Assertions.assertThrows(NullPointerException.class, () -> fileClient.deleteFile((String) null));
Assertions.assertThrows(NullPointerException.class, () -> fileClient.deleteFile((FileId) null));
Assertions.assertThrows(NullPointerException.class, () -> fileClient.getExpirationTime(null));
}

@Test
Expand Down Expand Up @@ -200,6 +201,14 @@ void testGetExpirationTime() throws Exception {
Assertions.assertTrue(expirationTime.isBefore(definedExpirationTime.plusSeconds(1)));
}

@Test
void testGetExpirationTimeForFailures() {
//given
final FileId invalidFileId = FileId.fromString("1.2.3");
//then
Assertions.assertThrows(HieroException.class, () -> fileClient.getExpirationTime(invalidFileId));
}

@Test
@Disabled("Always fails with AUTORENEW_DURATION_NOT_IN_RANGE. Needs to be investigated further.")
void testUpdateExpirationTime() throws Exception {
Expand Down

0 comments on commit 0d762a5

Please sign in to comment.