HyperLogLogPlusIsLessThan extends KoryphePredicate<HyperLogLogPlus> { @Override public boolean test(final HyperLogLogPlus input) { if (null == input) { return false; } final long cardinality = input.cardinality(); if (orEqualTo) { if (cardinality <= controlValue) { return true; } } else { if (cardinality < controlValue) { return true; } } return false; } HyperLogLogPlusIsLessThan();  HyperLogLogPlusIsLessThan(final long controlValue);  HyperLogLogPlusIsLessThan(final long controlValue, final boolean orEqualTo); @JsonProperty("value") long getControlValue(); void setControlValue(final long controlValue); boolean getOrEqualTo(); void setOrEqualTo(final boolean orEqualTo); @Override boolean test(final HyperLogLogPlus input); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void shouldAcceptWhenLessThan() { final HyperLogLogPlusIsLessThan filter = new HyperLogLogPlusIsLessThan(15); boolean accepted = filter.test(hyperLogLogPlusWithCardinality5); assertTrue(accepted); }
@Test public void shouldRejectWhenEqualToAndEqualToIsFalse() { final HyperLogLogPlusIsLessThan filter = new HyperLogLogPlusIsLessThan(15); boolean accepted = filter.test(hyperLogLogPlusWithCardinality15); assertFalse(accepted); }
@Test public void shouldAcceptWhenEqualToAndEqualToIsTrue() { final HyperLogLogPlusIsLessThan filter = new HyperLogLogPlusIsLessThan(15, true); boolean accepted = filter.test(hyperLogLogPlusWithCardinality15); assertTrue(accepted); }
@Test public void shouldRejectWhenMoreThan() { final HyperLogLogPlusIsLessThan filter = new HyperLogLogPlusIsLessThan(15); boolean accepted = filter.test(hyperLogLogPlusWithCardinality31); assertFalse(accepted); }
@Test public void shouldRejectWhenInputIsNull() { final HyperLogLogPlusIsLessThan filter = new HyperLogLogPlusIsLessThan(15); boolean accepted = filter.test(null); assertFalse(accepted); }