Merge pull request #1529 from mookkiah/issue_1500
issue 1500 - using JUnit 5 and resolved a build issue
This commit is contained in:
commit
f006782805
@ -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>
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user