public Properties apply(final Properties properties) {
    if (properties == null) {
      throw new IllegalArgumentException("properties must not be null");
    } else {
      if (properties.isEmpty()) {
        return new Properties();
      } else {
        final Properties filtered = new Properties();
        for (Map.Entry<Object, Object> entry : properties.entrySet()) {
          final Object key = entry.getKey();
          final Object value = entry.getValue();
          if (!keysToRemove.contains(key)) {
            filtered.put(key, value);
          }
        }
        return filtered;
      }
    }
  }
@Test
  public void filtersMatchingKey() {
    // Given
    Properties properties = new Properties();
    properties.put("one", 1);
    properties.put("two", 2);
    Set<String> removeOneKey = new HashSet<>();
    removeOneKey.add("one");
    Filter f = new Filter(removeOneKey);

    // When
    Properties filtered = f.apply(properties);

    // Then
    assertEquals(properties.size() - 1, filtered.size());
    assertFalse(filtered.containsKey("one"));
    assertTrue(filtered.containsKey("two"));
    assertEquals(properties.get("two"), filtered.get("two"));
  }