Search in sources :

Example 1 with ResultFilteringSieve

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);
}
Also used : ResultFilteringSieve(io.engineblock.activityapi.cyclelog.filters.tristate.ResultFilteringSieve) SimpleCycleResult(io.engineblock.activityapi.cyclelog.outputs.SimpleCycleResult) Test(org.testng.annotations.Test)

Example 2 with ResultFilteringSieve

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);
}
Also used : ResultFilteringSieve(io.engineblock.activityapi.cyclelog.filters.tristate.ResultFilteringSieve) SimpleCycleResult(io.engineblock.activityapi.cyclelog.outputs.SimpleCycleResult) Test(org.testng.annotations.Test)

Example 3 with ResultFilteringSieve

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);
}
Also used : ResultFilteringSieve(io.engineblock.activityapi.cyclelog.filters.tristate.ResultFilteringSieve) SimpleCycleResult(io.engineblock.activityapi.cyclelog.outputs.SimpleCycleResult) Test(org.testng.annotations.Test)

Aggregations

ResultFilteringSieve (io.engineblock.activityapi.cyclelog.filters.tristate.ResultFilteringSieve)3 SimpleCycleResult (io.engineblock.activityapi.cyclelog.outputs.SimpleCycleResult)3 Test (org.testng.annotations.Test)3