### Question:
SnapPreventionEdgeFilter implements EdgeFilter { @Override public boolean accept(EdgeIteratorState edgeState) { return filter.accept(edgeState) && !(avoidMotorway && edgeState.get(rcEnc) == MOTORWAY) && !(avoidTrunk && edgeState.get(rcEnc) == TRUNK) && !(avoidTunnel && edgeState.get(reEnc) == TUNNEL) && !(avoidBridge && edgeState.get(reEnc) == BRIDGE) && !(avoidFord && edgeState.get(reEnc) == FORD) && !(avoidFerry && edgeState.get(reEnc) == FERRY); } SnapPreventionEdgeFilter(EdgeFilter filter, EnumEncodedValue<RoadClass> rcEnc,
                                    EnumEncodedValue<RoadEnvironment> reEnc, List<String> snapPreventions); @Override boolean accept(EdgeIteratorState edgeState);  }### Answer:
@Test public void accept() { EdgeFilter trueFilter = new EdgeFilter() { @Override public boolean accept(EdgeIteratorState edgeState) { return true; } }; EncodingManager em = new EncodingManager.Builder().build(); EnumEncodedValue<RoadClass> rcEnc = em.getEnumEncodedValue(RoadClass.KEY, RoadClass.class); EnumEncodedValue<RoadEnvironment> reEnc = em.getEnumEncodedValue(RoadEnvironment.KEY, RoadEnvironment.class); SnapPreventionEdgeFilter filter = new SnapPreventionEdgeFilter(trueFilter, rcEnc, reEnc, Arrays.asList("motorway", "ferry")); IntsRef intsRef = em.createEdgeFlags(); assertTrue(filter.accept(GHUtility.createMockedEdgeIteratorState(1, intsRef))); reEnc.setEnum(false, intsRef, RoadEnvironment.FERRY); assertFalse(filter.accept(GHUtility.createMockedEdgeIteratorState(1, intsRef))); reEnc.setEnum(false, intsRef, RoadEnvironment.FORD); assertTrue(filter.accept(GHUtility.createMockedEdgeIteratorState(1, intsRef))); rcEnc.setEnum(false, intsRef, RoadClass.RESIDENTIAL); assertTrue(filter.accept(GHUtility.createMockedEdgeIteratorState(1, intsRef))); rcEnc.setEnum(false, intsRef, RoadClass.MOTORWAY); assertFalse(filter.accept(GHUtility.createMockedEdgeIteratorState(1, intsRef))); }