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:
parent
6d56fc5438
commit
1848c25f49
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue