Bael 1734 get file extension in java (#4522)

* change method to return Optionals

* add check for empty Optional

* replace ifPresent() with get()

* remove extra check
This commit is contained in:
Rajat Garg 2018-06-22 00:33:53 +05:30 committed by pauljervis
parent 6d56fc5438
commit 1848c25f49
1 changed files with 1 additions and 2 deletions

View File

@ -19,8 +19,7 @@ public class ExtensionUnitTest {
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