### Question:
EntityConfigResource extends AbstractBrooklynRestResource implements EntityConfigApi { @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void set(String application, String entityToken, String configName, Boolean recurse, Object newValue) { final Entity entity = brooklyn().getEntity(application, entityToken); if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.MODIFY_ENTITY, entity)) { throw WebResourceUtils.unauthorized("User '%s' is not authorized to modify entity '%s'", Entitlements.getEntitlementContext().user(), entity); } ConfigKey ck = findConfig(entity, configName); LOG.debug("REST setting config " + configName + " on " + entity + " to " + newValue); ((EntityInternal) entity).config().set(ck, TypeCoercions.coerce(newValue, ck.getTypeToken())); if (Boolean.TRUE.equals(recurse)) { for (Entity e2 : Entities.descendants(entity, Predicates.alwaysTrue(), false)) { ((EntityInternal) e2).config().set(ck, newValue); } } }  @Override List<EntityConfigSummary> list(final String application, final String entityToken); @Override Map<String, Object> batchConfigRead(String application, String entityToken, Boolean raw); @Override Object get(String application, String entityToken, String configKeyName, Boolean raw); @Override String getPlain(String application, String entityToken, String configKeyName, Boolean raw); Object get(boolean preferJson, String application, String entityToken, String configKeyName, Boolean raw); @SuppressWarnings({ "rawtypes", "unchecked" }) @Override void setFromMap(String application, String entityToken, Boolean recurse, Map newValues); @SuppressWarnings({ "rawtypes", "unchecked" }) @Override void set(String application, String entityToken, String configName, Boolean recurse, Object newValue);  }### Answer:
@Test public void testSet() throws Exception { try { String uri = "/v1/applications/simple-app/entities/simple-ent/config/"+ RestMockSimpleEntity.SAMPLE_CONFIG.getName(); ClientResponse response = client().resource(uri) .type(MediaType.APPLICATION_JSON_TYPE) .post(ClientResponse.class, "\"hello world\""); assertEquals(response.getStatus(), Response.Status.NO_CONTENT.getStatusCode()); assertEquals(entity.getConfig(RestMockSimpleEntity.SAMPLE_CONFIG), "hello world"); String value = client().resource(uri).accept(MediaType.APPLICATION_JSON_TYPE).get(String.class); assertEquals(value, "\"hello world\""); } finally { entity.config().set(RestMockSimpleEntity.SAMPLE_CONFIG, RestMockSimpleEntity.SAMPLE_CONFIG.getDefaultValue()); } }