SetProperty implements Action { @Override public String doAction(@Nonnull Resource resource) { ModifiableValueMap properties = resource.adaptTo(ModifiableValueMap.class); if (properties != null) { properties.put(name, value); return "Setting " + value.getClass().getSimpleName() + " property " + name + "=" + value + " for resource " + resource.getPath(); } return "WARNING: could not get ModifiableValueMap for resource " + resource.getPath(); } SetProperty(@Nonnull String name, Object value); @Override String doAction(@Nonnull Resource resource);  }
@Test public void doAction() throws PersistenceException { SetProperty action = new SetProperty(ATTR, VAL1); action.doAction(resource); verify(valueMap, times(1)).put(ATTR, VAL1); }