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>
<artifactId>trampoline</artifactId>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>

View File

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

View File

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