Skip to content

Commit

Permalink
Bael 1734 get file extension in java (eugenp#4522)
Browse files Browse the repository at this point in the history
* change method to return Optionals

* add check for empty Optional

* replace ifPresent() with get()

* remove extra check
  • Loading branch information
rajat-garg authored and pauljervis committed Jun 21, 2018
1 parent 6d56fc5 commit 1848c25
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public void getExtension_whenApacheCommonIO_thenExtensionIsTrue() {
public void getExtension_whenStringHandle_thenExtensionIsTrue() {
String expectedExtension = "java";
Optional<String> actualExtension = extension.getExtensionByStringHandling("Demo.java");
Assert.assertTrue(actualExtension.isPresent());
actualExtension.ifPresent(ext -> Assert.assertEquals(expectedExtension,ext));
Assert.assertEquals(expectedExtension, actualExtension.get());
}

@Test
Expand Down

0 comments on commit 1848c25

Please sign in to comment.