### Question:
DataSetHelper { public abstract ManagedIndividual manage(ManagedIndividualId id) throws DataSetModificationException; DataSetHelper(); abstract S replace(Serializable from, T to, Class<? extends S> clazz); abstract ManagedIndividual manage(ManagedIndividualId id); abstract T self(); abstract T relative(URI path); abstract IndividualHelper externalIndividual(URI uri); abstract IndividualHelper managedIndividual(Name<?> name, String managerId); abstract IndividualHelper relativeIndividual(Name<?> name, String managerId, URI path); abstract IndividualHelper localIndividual(Name<?> name); static final URI SELF; }### Answer:
@Test public void testManagesSelf() throws Exception { DataSet dataSet = exampleDataSet(); Individual<?,?> original = dataSet.individualOfId(SELF); Individual<?,?> individual= DataSetUtils. newHelper(dataSet). manage(managedIndividualId("other","managerId")); assertIsProperlyRenamed(dataSet, original, individual, "self"); }
@Test(expected=DataSetModificationException.class) public void testCannotManagedUsingAnExistingManagedIndividual() throws Exception { DataSet dataSet = exampleDataSet(); DataSetUtils. newHelper(dataSet). manage(MANAGED_INDIVIDUAL_ID); }
@Test(expected=DataSetModificationException.class) public void testCannotManageIfSelfDoesNotExist() throws Exception { DataSet dataSet = exampleDataSet(); Individual<?,?> original = dataSet.individualOfId(SELF); dataSet.remove(original); DataSetUtils. newHelper(dataSet). manage(managedIndividualId("other","managerId")); }