File tree Expand file tree Collapse file tree
main/java/de/codecentric/java8examples/methodreference
test/java/de/codecentric/java8examples/methodreference Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 * Time: 16:27
88 * To change this template use File | Settings | File Templates.
99 */
10- public class MethodReference {
10+ public class Foo {
1111
1212 public String doSomething () {
13- return "MethodReference .doSomething()" ;
13+ return "Foo .doSomething()" ;
1414 }
1515}
Original file line number Diff line number Diff line change 1414 * Time: 16:29
1515 * To change this template use File | Settings | File Templates.
1616 */
17- public class MethodReferenceTest {
17+ public class MethodReferenceExampleTest {
1818
19- private MethodReference ref ;
19+ private Foo myFoo ;
2020
2121 @ Before
2222 public void setUp () throws Exception {
23- ref = new MethodReference ();
23+ myFoo = new Foo ();
2424 }
2525
2626 @ Test
27- public void callingMethodFromRunnable () throws Exception {
28- Callable <String > callable = ref ::doSomething ;
27+ public void methodReferencToFooMethod () throws Exception {
28+ Callable <String > callable = myFoo ::doSomething ;
2929
30- assertEquals (ref .doSomething (), callable .call ());
30+ assertEquals (myFoo .doSomething (), callable .call ());
3131 }
3232}
You can’t perform that action at this time.
0 commit comments