### Question:
EntityResource extends AbstractBrooklynRestResource implements EntityApi { @Override public List<EntitySummary> getChildren(final String application, final String entity) { return FluentIterable .from(brooklyn().getEntity(application, entity).getChildren()) .filter(EntitlementPredicates.isEntitled(mgmt().getEntitlementManager(), Entitlements.SEE_ENTITY)) .transform(EntityTransformer.FROM_ENTITY) .toList(); }  @Override List<EntitySummary> list(final String application); @Override EntitySummary get(String application, String entityName); @Override List<EntitySummary> getChildren(final String application, final String entity); @Override List<EntitySummary> getChildrenOld(String application, String entity); @Override Response addChildren(String applicationToken, String entityToken, Boolean start, String timeoutS, String yaml); @Override List<TaskSummary> listTasks(String applicationId, String entityId); @Override TaskSummary getTask(final String application, final String entityToken, String taskId); @SuppressWarnings("unchecked") @Override List<Object> listTags(String applicationId, String entityId); @Override Response getIcon(String applicationId, String entityId); @Override Response rename(String application, String entity, String newName); @Override Response expunge(String application, String entity, boolean release); @Override List<EntitySummary> getDescendants(String application, String entity, String typeRegex); @Override Map<String, Object> getDescendantsSensor(String application, String entity, String sensor, String typeRegex); @Override List<LocationSummary> getLocations(String application, String entity); @Override String getSpec(String applicationToken, String entityToken);  }### Answer:
@Test public void testAddChild() throws Exception { try { ClientResponse response = client().resource(entityEndpoint + "/children?timeout=10s") .entity("services: [ { type: "+TestEntity.class.getName()+" }]", "application/yaml") .post(ClientResponse.class); HttpAsserts.assertHealthyStatusCode(response.getStatus()); Assert.assertEquals(entity.getChildren().size(), 1); Entity child = Iterables.getOnlyElement(entity.getChildren()); Assert.assertTrue(Entities.isManaged(child)); TaskSummary task = response.getEntity(TaskSummary.class); Assert.assertEquals(task.getResult(), MutableList.of(child.getId())); } finally { Collection<Entity> children = entity.getChildren(); if (!children.isEmpty()) Entities.unmanage(Iterables.getOnlyElement(children)); } }