PropertyDelegator extends BaseDelegator implements IPropertyDelegator { @Override public String deleteProperty(final String name, final PropertyOptions opts) throws P4JavaException { String error = "Property/option name shouldn't null or empty"; if (isBlank(name)) { if (opts == null || isBlank(opts.getName())) { throw new IllegalArgumentException(error); } } PropertyOptions propertyOptions = opts; if (isNull(opts)) { propertyOptions = new PropertyOptions(); } if (isNotBlank(name)) { propertyOptions.setName(name); } List<Map<String, Object>> resultMaps = execMapCmdList( PROPERTY, processParameters(propertyOptions, null, new String[]{"-d"}, server), null); return parseCommandResultMapAsString(resultMaps); } PropertyDelegator(IOptionsServer server); @Override String setProperty(
            final String name,
            final String value,
            final PropertyOptions opts); @Override List<IProperty> getProperty(final GetPropertyOptions opts); @Override String deleteProperty(final String name, final PropertyOptions opts);  }
@Test public void testDeletePropertyShouldReturnNonBlankDeletePropertyNameWhenPropertyOptionsIsNull() throws Exception { name = "not blank name"; propertyOptions = null; deletePropertyShouldReturnNonBlankDeletePropertyName( new UnitTestWhen<String>() { @Override public String when() throws P4JavaException, InvocationTargetException, IllegalAccessException { return propertyDelegator.deleteProperty(name, propertyOptions); } }); }
@Test public void testDeletePropertyShouldReturnNonBlankDeletePropertyNameWhenPropertyOptionsIsNonNull() throws Exception { when(propertyOptions.getName()).thenReturn("name"); when(propertyOptions.getValue()).thenReturn("value"); deletePropertyShouldReturnNonBlankDeletePropertyName( new UnitTestWhen<String>() { @Override public String when() throws P4JavaException, InvocationTargetException, IllegalAccessException { return propertyDelegator.deleteProperty("name", propertyOptions); } }); }