SupportedDirections implements Comparable<SupportedDirections> { public boolean isDirectionSupported(Direction direction) { return direction == Direction.FROM && from || direction == Direction.TO && to; } SupportedDirections(boolean from, boolean to); boolean isDirectionSupported(Direction direction); String toString(); static SupportedDirections fromString(String supportedDirections); static SupportedDirections fromDirection(Direction direction); @Override int compareTo(SupportedDirections o);  }
@Test public void testIsDirectionSupported() { SupportedDirections supportedDirections = new SupportedDirections(true, true); Assert.assertTrue( supportedDirections.isDirectionSupported(Direction.FROM)); Assert.assertTrue( supportedDirections.isDirectionSupported(Direction.TO)); supportedDirections = new SupportedDirections(true, false); Assert.assertTrue( supportedDirections.isDirectionSupported(Direction.FROM)); Assert.assertFalse( supportedDirections.isDirectionSupported(Direction.TO)); supportedDirections = new SupportedDirections(false, true); Assert.assertFalse( supportedDirections.isDirectionSupported(Direction.FROM)); Assert.assertTrue( supportedDirections.isDirectionSupported(Direction.TO)); supportedDirections = new SupportedDirections(false, false); Assert.assertFalse( supportedDirections.isDirectionSupported(Direction.FROM)); Assert.assertFalse( supportedDirections.isDirectionSupported(Direction.TO)); }