Merge pull request #1529 from mookkiah/issue_1500

issue 1500 - using JUnit 5 and resolved a build issue
This commit is contained in:
Ilkka Seppälä 2020-10-17 18:02:56 +03:00 committed by GitHub
commit f006782805
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 11 deletions

View File

@ -35,11 +35,6 @@
</parent> </parent>
<artifactId>trampoline</artifactId> <artifactId>trampoline</artifactId>
<dependencies> <dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>

View File

@ -98,12 +98,12 @@ public interface Trampoline<T> {
return trampoline(this); return trampoline(this);
} }
T trampoline(final Trampoline<T> trampoline) { private T trampoline(final Trampoline<T> trampoline) {
return Stream.iterate(trampoline, Trampoline::jump) return Stream.iterate(trampoline, Trampoline::jump)
.filter(Trampoline::complete) .filter(Trampoline::complete)
.findFirst() .findFirst()
.map(Trampoline::result) .map(Trampoline::result)
.orElseThrow(); .get();
} }
}; };
} }

View File

@ -23,10 +23,9 @@
package com.iluwatar.trampoline; package com.iluwatar.trampoline;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/** /**
* Test for trampoline pattern. * Test for trampoline pattern.
@ -37,7 +36,7 @@ public class TrampolineAppTest {
@Test @Test
public void testTrampolineWithFactorialFunction() { public void testTrampolineWithFactorialFunction() {
long result = TrampolineApp.loop(10, 1).result(); long result = TrampolineApp.loop(10, 1).result();
assertEquals("Be equal", 3628800, result); assertEquals(3_628_800, result);
} }
} }