convert tail call test to kotlin
This commit is contained in:
parent
c08edda548
commit
4c8342a9f7
|
@ -1,31 +0,0 @@
|
|||
package recursion;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static recursion.TailCalls.done;
|
||||
|
||||
public class TailCallTest {
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void tailCallDoesNotSupportResult() {
|
||||
TailCall<Object> tailCall = new TailCall<Object>() {
|
||||
|
||||
@Override
|
||||
public TailCall<Object> apply() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
tailCall.result();
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void doneDoesNotSupportApply() {
|
||||
done(null).apply();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TailCallsCoverage() {
|
||||
new TailCalls();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package recursion
|
||||
|
||||
import org.junit.jupiter.api.Assertions.assertThrows
|
||||
import org.junit.jupiter.api.Test
|
||||
import recursion.TailCalls.done
|
||||
|
||||
class TailCallTest {
|
||||
|
||||
@Test
|
||||
fun `tailCall does not support result`() {
|
||||
val tailCall = TailCall<Any> { null }
|
||||
|
||||
assertThrows(UnsupportedOperationException::class.java) { tailCall.result() }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `done does not support apply`() {
|
||||
assertThrows(UnsupportedOperationException::class.java) { done<Any>(null).apply() }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue