### Question:
VehicleFilter implements Predicate<Vehicle> { @Override public boolean test(Vehicle vehicle) { boolean accept = true; if (procState != null && !procState.equals(vehicle.getProcState().name())) { accept = false; } return accept; } VehicleFilter(String procState); @Override boolean test(Vehicle vehicle);  }### Answer:
@Test public void acceptsAllForNoParams() { VehicleFilter emptyFilter = new VehicleFilter(null); assertTrue(emptyFilter.test(vehicle1)); assertTrue(emptyFilter.test(vehicle2)); assertTrue(emptyFilter.test(vehicle3)); assertTrue(emptyFilter.test(vehicle4)); }
@Test public void detectsIdleVehicles() { VehicleFilter idleVehiclesFilter = new VehicleFilter("IDLE"); assertTrue(idleVehiclesFilter.test(vehicle1)); assertFalse(idleVehiclesFilter.test(vehicle2)); assertFalse(idleVehiclesFilter.test(vehicle3)); assertFalse(idleVehiclesFilter.test(vehicle4)); }