diff --git a/core-java/src/test/java/com/baeldung/extension/ExtensionUnitTest.java b/core-java/src/test/java/com/baeldung/extension/ExtensionUnitTest.java index 14e05d6b95..680eea0cae 100644 --- a/core-java/src/test/java/com/baeldung/extension/ExtensionUnitTest.java +++ b/core-java/src/test/java/com/baeldung/extension/ExtensionUnitTest.java @@ -19,8 +19,7 @@ public class ExtensionUnitTest { public void getExtension_whenStringHandle_thenExtensionIsTrue() { String expectedExtension = "java"; Optional actualExtension = extension.getExtensionByStringHandling("Demo.java"); - Assert.assertTrue(actualExtension.isPresent()); - actualExtension.ifPresent(ext -> Assert.assertEquals(expectedExtension,ext)); + Assert.assertEquals(expectedExtension, actualExtension.get()); } @Test