ValuePropertiesUtils { public static ValueProperties.Builder removeAll(final ValueProperties originalProperties, final String... propertiesToRemove) { ArgumentChecker.notNull(originalProperties, "original properties"); final ValueProperties.Builder newProperties = originalProperties.copy(); if (propertiesToRemove == null || propertiesToRemove.length == 0) { return newProperties; } for (final String propertyName : propertiesToRemove) { newProperties.withoutAny(propertyName); } return newProperties; }  static ValueProperties.Builder addOptional(final ValueProperties originalProperties, final String propertyName, final String propertyValue); static ValueProperties.Builder addAllOptional(final ValueProperties originalProperties, final ValueProperties propertiesToAdd); static void withAllOptional(final ValueProperties.Builder properties, final ValueProperties propertiesToAdd); static ValueProperties.Builder removeAll(final ValueProperties originalProperties, final String... propertiesToRemove); static ValueProperties.Builder getAllOptional(final ValueProperties originalProperties);  }
@Test public void testRemoveAllNullSupplied() { final ValueProperties properties = ValuePropertiesUtils.removeAll(CURVE_PROPERTIES, (String[]) null).get(); assertFalse(CURVE_PROPERTIES == properties); assertEquals(CURVE_PROPERTIES, properties); }
@Test public void testRemoveAllEmptySupplied() { final ValueProperties properties = ValuePropertiesUtils.removeAll(CURVE_PROPERTIES, new String[0]).get(); assertFalse(CURVE_PROPERTIES == properties); assertEquals(CURVE_PROPERTIES, properties); }
@Test public void testRemoveAllNoOverlap() { final ValueProperties properties = ValuePropertiesUtils.removeAll(CURVE_PROPERTIES, ValuePropertyNames.RECEIVE_CURVE, ValuePropertyNames.RECEIVE_CURVE_CALCULATION_CONFIG).get(); assertFalse(CURVE_PROPERTIES == properties); assertEquals(CURVE_PROPERTIES, properties); }
@Test public void testRemoveAll() { final ValueProperties expectedProperties = ValueProperties.builder() .with(ValuePropertyNames.CURVE_CALCULATION_CONFIG, "CurveCalculationConfigName") .get(); final ValueProperties remainingProperties = ValuePropertiesUtils.removeAll(CURVE_PROPERTIES, ValuePropertyNames.CURVE, ValuePropertyNames.PAY_CURVE_CALCULATION_CONFIG, ValuePropertyNames.CURVE_CALCULATION_METHOD).get(); assertFalse(CURVE_PROPERTIES == remainingProperties); assertEquals(expectedProperties, remainingProperties); }