use of io.engineblock.activityapi.cyclelog.filters.tristate.ResultFilteringSieve in project engineblock by engineblock.
the class ResultFilteringSieveTest method testBasicFilter.
@Test
public void testBasicFilter() {
ResultFilteringSieve sieve = new ResultFilteringSieve.Builder().discardByDefault().include(3).build();
assertThat(sieve.apply(new SimpleCycleResult(3L, 2))).isEqualTo(TristateFilter.Policy.Discard);
assertThat(sieve.apply(new SimpleCycleResult(3L, 3))).isEqualTo(TristateFilter.Policy.Keep);
}
use of io.engineblock.activityapi.cyclelog.filters.tristate.ResultFilteringSieve in project engineblock by engineblock.
the class ResultFilteringSieveTest method testDefaultPolicy.
@Test
public void testDefaultPolicy() {
ResultFilteringSieve sieve = new ResultFilteringSieve.Builder().discardByDefault().build();
assertThat(sieve.apply(new SimpleCycleResult(4, 5))).isEqualTo(TristateFilter.Policy.Discard);
}
use of io.engineblock.activityapi.cyclelog.filters.tristate.ResultFilteringSieve in project engineblock by engineblock.
the class ResultFilteringSieveTest method testRangeFilter.
@Test
public void testRangeFilter() {
ResultFilteringSieve sieve = new ResultFilteringSieve.Builder().keepByDefault().exclude(3, 7).exclude(9).build();
assertThat(sieve.apply(new SimpleCycleResult(3L, 2))).isEqualTo(TristateFilter.Policy.Keep);
assertThat(sieve.apply(new SimpleCycleResult(3L, 3))).isEqualTo(TristateFilter.Policy.Discard);
assertThat(sieve.apply(new SimpleCycleResult(3L, 7))).isEqualTo(TristateFilter.Policy.Discard);
assertThat(sieve.apply(new SimpleCycleResult(3L, 8))).isEqualTo(TristateFilter.Policy.Keep);
assertThat(sieve.apply(new SimpleCycleResult(3L, 9))).isEqualTo(TristateFilter.Policy.Discard);
assertThat(sieve.apply(new SimpleCycleResult(3L, 10))).isEqualTo(TristateFilter.Policy.Keep);
}
Aggregations