Filter { public static Function<Beacon, Boolean> distanceIsGreaterThan(final double distance) { return new Function<Beacon, Boolean>() { @Override public Boolean apply(Beacon beacon) { return beacon.getDistance() > distance; } }; }  static Function<Beacon, Boolean> proximityIsEqualTo(final Proximity... proximities); static Function<Beacon, Boolean> proximityIsNotEqualTo(final Proximity... proximities); static Function<Beacon, Boolean> distanceIsEqualTo(final double distance); static Function<Beacon, Boolean> distanceIsGreaterThan(final double distance); static Function<Beacon, Boolean> distanceIsLowerThan(final double distance); static Function<Beacon, Boolean> hasName(final String... names); static Function<Beacon, Boolean> exceptName(final String... names); static Function<Beacon, Boolean> hasMacAddress(final String... macs); static Function<Beacon, Boolean> exceptMacAddress(final String... macs); static Function<Beacon, Boolean> hasMacAddress(final MacAddress... macs); static Function<Beacon, Boolean> exceptMacAddress(final MacAddress... macs);  }
@Test public void distanceShouldBeGreaterThanTen() { Beacon beacon = Mockito.mock(Beacon.class); when(beacon.getDistance()).then(new Answer<Double>() { @Override public Double answer(InvocationOnMock invocationOnMock) throws Throwable { return 15d; } }); Function<Beacon, Boolean> filter = Filter.distanceIsGreaterThan(10); Boolean call = apply(filter, beacon); assertThat(call).isTrue(); }