ManagedObject parentMo = inventory.getManagedObject(parent.getId());
parentMo.addChildDevice(childRef1);
parentMo.addChildDevice(child2.getId());
// Then
ManagedObjectReferenceCollectionRepresentation refCollection = inventory.getManagedObject(
parent.getId()).getChildDevices().get();
List<ManagedObjectReferenceRepresentation> refs = refCollection.getReferences();
Set<GId> childDeviceIDs = asSet(refs.get(0).getManagedObject().getId(), refs.get(1).getManagedObject().getId());
assertThat(childDeviceIDs, is(asSet(child1.getId(), child2.getId())));
// When
parentMo.deleteChildDevice(child1.getId());
parentMo.deleteChildDevice(child2.getId());
// Then
ManagedObjectReferenceCollectionRepresentation allChildDevices = inventory.getManagedObject(
parent.getId()).getChildDevices().get();
assertEquals(0, allChildDevices.getReferences().size());
}