BAEL-3722: Sync article and the code (#9897)
This commit is contained in:
parent
00e8b70870
commit
c9e9ff79e9
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue