diff --git a/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/Bar.java b/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/Bar.java index 4cf0aa2399..3ee78bd7a3 100644 --- a/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/Bar.java +++ b/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/Bar.java @@ -6,8 +6,11 @@ public interface Bar { String method(String string); - default String defaultMethod() { - return "String from Bar"; + default String defaultBar() { + return "Default String from Bar"; } + default String defaultCommon() { + return "Default Common from Bar"; + } } diff --git a/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/Baz.java b/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/Baz.java index c7efe14c89..1e1e9ae094 100644 --- a/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/Baz.java +++ b/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/Baz.java @@ -6,7 +6,11 @@ public interface Baz { String method(String string); - default String defaultMethod() { - return "String from Baz"; + default String defaultBaz() { + return "Default String from Baz"; + } + + default String defaultCommon(){ + return "Default Common from Baz"; } } diff --git a/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/FooExtended.java b/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/FooExtended.java index 9141cd8eb8..27ab86dca3 100644 --- a/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/FooExtended.java +++ b/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/FooExtended.java @@ -5,8 +5,7 @@ package com.baeldung.java8.lambda.tips; public interface FooExtended extends Baz, Bar { @Override - default String defaultMethod() { - return Bar.super.defaultMethod(); + default String defaultCommon() { + return Bar.super.defaultCommon(); } - } diff --git a/core-java-modules/core-java-lambdas/src/test/java/com/baeldung/java8/lambda/tips/Java8FunctionalInteracesLambdasUnitTest.java b/core-java-modules/core-java-lambdas/src/test/java/com/baeldung/java8/lambda/tips/Java8FunctionalInteracesLambdasUnitTest.java index b409f8e37f..acc3bc8fa3 100644 --- a/core-java-modules/core-java-lambdas/src/test/java/com/baeldung/java8/lambda/tips/Java8FunctionalInteracesLambdasUnitTest.java +++ b/core-java-modules/core-java-lambdas/src/test/java/com/baeldung/java8/lambda/tips/Java8FunctionalInteracesLambdasUnitTest.java @@ -39,9 +39,9 @@ public class Java8FunctionalInteracesLambdasUnitTest { @Test public void defaultMethodFromExtendedInterface_whenReturnDefiniteString_thenCorrect() { final FooExtended fooExtended = string -> string; - final String result = fooExtended.defaultMethod(); + final String result = fooExtended.defaultCommon(); - assertEquals("String from Bar", result); + assertEquals("Default Common from Bar", result); } @Test