@Test public void testMovement() { final Creature swimmingCreature = mock(Creature.class); when(swimmingCreature.getMovement()).thenReturn(Movement.SWIMMING); final Creature flyingCreature = mock(Creature.class); when(flyingCreature.getMovement()).thenReturn(Movement.FLYING); final MovementSelector swimmingSelector = new MovementSelector(Movement.SWIMMING); assertTrue(swimmingSelector.test(swimmingCreature)); assertFalse(swimmingSelector.test(flyingCreature)); }
@Override public boolean test(Creature t) { return t.getMovement().equals(m); }
MovementSelector implements Predicate<Creature> { @Override public boolean test(Creature t) { return t.getMovement().equals(m); } }
MovementSelector implements Predicate<Creature> { @Override public boolean test(Creature t) { return t.getMovement().equals(m); } MovementSelector(Movement m); }
MovementSelector implements Predicate<Creature> { @Override public boolean test(Creature t) { return t.getMovement().equals(m); } MovementSelector(Movement m); @Override boolean test(Creature t); }
MovementSelector implements Predicate<Creature> { @Override public boolean test(Creature t) { return t.getMovement().equals(m); } MovementSelector(Movement m); @Override boolean test(Creature t);  }