File tree 3 files changed +5
-11
lines changed
main/java/com/iluwatar/trampoline
test/java/com/iluwatar/trampoline 3 files changed +5
-11
lines changed Original file line number Diff line number Diff line change 35
35
</parent >
36
36
<artifactId >trampoline</artifactId >
37
37
<dependencies >
38
- <dependency >
39
- <groupId >junit</groupId >
40
- <artifactId >junit</artifactId >
41
- <scope >test</scope >
42
- </dependency >
43
38
44
39
<dependency >
45
40
<groupId >org.junit.jupiter</groupId >
Original file line number Diff line number Diff line change @@ -98,12 +98,12 @@ public T get() {
98
98
return trampoline (this );
99
99
}
100
100
101
- T trampoline (final Trampoline <T > trampoline ) {
101
+ private T trampoline (final Trampoline <T > trampoline ) {
102
102
return Stream .iterate (trampoline , Trampoline ::jump )
103
103
.filter (Trampoline ::complete )
104
104
.findFirst ()
105
105
.map (Trampoline ::result )
106
- .orElseThrow ();
106
+ .get ();
107
107
}
108
108
};
109
109
}
Original file line number Diff line number Diff line change 23
23
24
24
package com .iluwatar .trampoline ;
25
25
26
- import static org .junit .Assert .assertEquals ;
27
-
28
- import org .junit .Test ;
26
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
29
27
28
+ import org .junit .jupiter .api .Test ;
30
29
31
30
/**
32
31
* Test for trampoline pattern.
@@ -37,7 +36,7 @@ public class TrampolineAppTest {
37
36
@ Test
38
37
public void testTrampolineWithFactorialFunction () {
39
38
long result = TrampolineApp .loop (10 , 1 ).result ();
40
- assertEquals ("Be equal" , 3628800 , result );
39
+ assertEquals (3_628_800 , result );
41
40
}
42
41
43
42
}
You can’t perform that action at this time.
0 commit comments