EntityFunctions { public static Function<Entity, Location> locationMatching(Predicate<? super Location> filter) { return new LocationMatching(filter); }  static Function<Entity, Object> attribute(String attributeName); static Function<Entity, T> attribute(AttributeSensor<T> attribute); static Function<Entity, String> attribute(String attributeName, String format); static Function<Entity, String> attribute(AttributeSensor<?> attribute, String format); static Function<Object, T> attribute(Entity entity, AttributeSensor<T> attribute); static Function<Entity, Object> config(String keyName); static Function<Entity, T> config(ConfigKey<T> key); static Function<Entity, String> config(String keyName, String format); static Function<Entity, String> config(ConfigKey<?> key, String format); static Function<Entity, String> displayName(); static Function<Identifiable, String> id(); static Function<Entity,Void> settingSensorsConstant(final Map<AttributeSensor<?>,Object> values); static Runnable settingSensorsConstant(final Entity entity, final Map<AttributeSensor<?>,Object> values); static Function<Entity, Void> updatingSensorMapEntry(final AttributeSensor<Map<K,V>> mapSensor, final K key, final Supplier<? extends V> valueSupplier); static Runnable updatingSensorMapEntry(final Entity entity, final AttributeSensor<Map<K,V>> mapSensor, final K key, final Supplier<? extends V> valueSupplier); static Supplier<Collection<Application>> applications(ManagementContext mgmt); static Function<Entity, Location> locationMatching(Predicate<? super Location> filter); static Function<Entity, Entity> parent(); static Function<Entity, ConfigKey<T>> configKeyFinder(ConfigKey<T> queryKey, @Nullable ConfigKey<T> defaultValue); static Function<Entity, ConfigKey<T>> configKeyFinder(ConfigKey<T> queryKey);  }
@Test public void testLocationMatching() throws Exception { entity.addLocations(ImmutableList.of(loc)); assertEquals(EntityFunctions.locationMatching(Predicates.alwaysTrue()).apply(entity), loc); }