Skip to content

Commit

Permalink
Avoid usage of null value in TimedFunc
Browse files Browse the repository at this point in the history
For #887
  • Loading branch information
victornoel committed Jul 7, 2018
1 parent 050dd73 commit 63ee642
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
14 changes: 0 additions & 14 deletions src/main/java/org/cactoos/func/TimedFunc.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 <X> Type of input
* @param <Y> 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<X, Y> implements Func<X, Y> {

Expand All @@ -52,15 +47,6 @@ public final class TimedFunc<X, Y> implements Func<X, Y> {
*/
private final long time;

/**
* Ctor.
* @param proc Proc
* @param milliseconds Milliseconds
*/
public TimedFunc(final Proc<X> proc, final long milliseconds) {
this(new FuncOf<>(proc, null), milliseconds);
}

/**
* Ctor.
* @param function Origin function
Expand Down
13 changes: 0 additions & 13 deletions src/test/java/org/cactoos/func/TimedFuncTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Boolean, Boolean>(
input -> {
new And(
new Endless<>(() -> input)
).value();
},
period
).apply(true);
}

@Test
@SuppressWarnings("PMD.AvoidCatchingGenericException")
public void futureTaskIsCancelled() {
Expand Down

0 comments on commit 63ee642

Please sign in to comment.