Skip to content

Commit

Permalink
replacing NotCondition with lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
toby-weston-db committed Jan 21, 2014
1 parent 418413e commit f281c6d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@
import org.junit.Assert;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeoutException;

public final class Conditions {

public static Condition not(Condition condition) {
return new NotCondition(condition);
return () -> !condition.isSatisfied();
}

public static Condition shutdown(ExecutorService service) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,9 @@

public class NotConditionTest {

private Condition TRUE = new Condition() {
public boolean isSatisfied() {
return true;
}
};

private Condition FALSE = new Condition() {
public boolean isSatisfied() {
return false;
}
};

@Test
public void notCondition() {
assertThat(not(TRUE), is(false)); ;
assertThat(not(FALSE), is(true));
assertThat(not(() -> true), is(false)); ;
assertThat(not(() -> false), is(true));
}
}

0 comments on commit f281c6d

Please sign in to comment.