### Question:
BdbUtils { static Properties filterToBdbProps(Properties properties) { Properties filteredProperties = new Properties(); try (Stream<Object> stream = properties.keySet().stream()) { stream.filter(key -> key instanceof String) .map(key -> (String) key) .filter(EnvironmentParams.SUPPORTED_PARAMS::containsKey) .forEach(key -> { String baseValue = properties.getProperty(key); if (NUMBER_UNIT.matcher(baseValue).matches()) { String convertedValue = Long.toString(Size.parse(baseValue).toBytes()); filteredProperties.setProperty(key, convertedValue); } else { filteredProperties.setProperty(key, baseValue); } }); } return filteredProperties; } private  BdbUtils();   }### Answer:
@Test public void filterToBdbProps() throws Exception { Properties properties = new Properties(); properties.setProperty("com.addthis.some.prop", "super awesome"); properties.setProperty("je.sharedCache", "True"); Properties filteredProperties = BdbUtils.filterToBdbProps(properties); Assert.assertEquals("filtered properties should be reduced by one", 1, filteredProperties.size()); Assert.assertEquals("je.sharedCache should be the one kept", "je.sharedCache", filteredProperties.keys().nextElement()); }
@Test public void bytesShorthand() throws Exception { Properties properties = new Properties(); properties.setProperty("je.maxMemory", "1750MiB"); Properties filteredProperties = BdbUtils.filterToBdbProps(properties); Assert.assertEquals("byte amounts need to be dumbed down", 1024 * 1024 * 1750, Long.parseLong(filteredProperties.getProperty("je.maxMemory"))); }