From 63ee642f4cf11002d856bca531baf064906fd9e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victor=20No=C3=ABl?= Date: Sat, 7 Jul 2018 15:33:45 +0200 Subject: [PATCH] Avoid usage of null value in TimedFunc For #887 --- src/main/java/org/cactoos/func/TimedFunc.java | 14 -------------- src/test/java/org/cactoos/func/TimedFuncTest.java | 13 ------------- 2 files changed, 27 deletions(-) diff --git a/src/main/java/org/cactoos/func/TimedFunc.java b/src/main/java/org/cactoos/func/TimedFunc.java index b5eeee68aa..5f5cf6654f 100644 --- a/src/main/java/org/cactoos/func/TimedFunc.java +++ b/src/main/java/org/cactoos/func/TimedFunc.java @@ -28,17 +28,12 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.cactoos.Func; -import org.cactoos.Proc; /** * Function that gets interrupted after a certain time has passed. * @param Type of input * @param Type of output * @since 0.29.3 - * @todo #861:30min Avoid usage of null value in ctor(Proc, long) which is - * against design principles. - * Perhaps in creating TimedProc? - * Please take a look on #551 and #843 for more details. */ public final class TimedFunc implements Func { @@ -52,15 +47,6 @@ public final class TimedFunc implements Func { */ private final long time; - /** - * Ctor. - * @param proc Proc - * @param milliseconds Milliseconds - */ - public TimedFunc(final Proc proc, final long milliseconds) { - this(new FuncOf<>(proc, null), milliseconds); - } - /** * Ctor. * @param function Origin function diff --git a/src/test/java/org/cactoos/func/TimedFuncTest.java b/src/test/java/org/cactoos/func/TimedFuncTest.java index d2eb9828f6..1e3c90716c 100644 --- a/src/test/java/org/cactoos/func/TimedFuncTest.java +++ b/src/test/java/org/cactoos/func/TimedFuncTest.java @@ -52,19 +52,6 @@ public void functionGetsInterrupted() throws Exception { ).apply(true); } - @Test(expected = TimeoutException.class) - public void procGetsInterrupted() throws Exception { - final long period = 100L; - new TimedFunc( - input -> { - new And( - new Endless<>(() -> input) - ).value(); - }, - period - ).apply(true); - } - @Test @SuppressWarnings("PMD.AvoidCatchingGenericException") public void futureTaskIsCancelled() {