### Question:
StandardInteractiveSpacesDomainCloner implements InteractiveSpacesDomainCloner { @Override public Space cloneSpace(Space src) { String id = src.getId(); Space clone = spaceClones.get(id); if (clone != null) { return clone; } clone = activityRepository.newSpace(); clone.setName(namePrefix + " " + src.getName()); clone.setDescription(src.getDescription()); clone.setMetadata(src.getMetadata()); for (Space subspace : src.getSpaces()) { Space subspaceClone = cloneSpace(subspace); clone.addSpace(subspaceClone); } for (LiveActivityGroup group : src.getActivityGroups()) { LiveActivityGroup groupClone = cloneLiveActivityGroup(group); clone.addActivityGroup(groupClone); } spaceClones.put(id, clone); return clone; } StandardInteractiveSpacesDomainCloner(ActivityRepository activityRepository); @Override void setNamePrefix(String namePrefix); @Override void setControllerMap(Map<SpaceController, SpaceController> controllerMap); @Override void saveClones(); @Override LiveActivity cloneLiveActivity(LiveActivity src); @Override LiveActivity getClonedLiveActivity(String srcId); @Override ActivityConfiguration cloneConfiguration(ActivityConfiguration src); @Override LiveActivityGroup cloneLiveActivityGroup(LiveActivityGroup src); @Override LiveActivityGroup getClonedLiveActivityGroup(String srcId); @Override Space cloneSpace(Space src); @Override Space getClonedSpace(String srcId);  }### Answer:
@Test public void testSpaceCopy() { LiveActivityGroup srcLiveActivityGroup1 = newLiveActivityGroup(Lists.newArrayList(newLiveActivity(activity1, controller1), newLiveActivity(activity2, controller2))); LiveActivityGroup srcLiveActivityGroup2 = newLiveActivityGroup(Lists.newArrayList(newLiveActivity(activity3, controller3))); Space srcSpace = new SimpleSpace(); srcSpace.setDescription(DESCRIPTION); srcSpace.setMetadata(metadata); srcSpace.addActivityGroup(srcLiveActivityGroup1); Space srcSubspace = new SimpleSpace(); srcSubspace.setDescription(DESCRIPTION); srcSubspace.setMetadata(metadata); srcSubspace.addActivityGroup(srcLiveActivityGroup2); srcSpace.addSpace(srcSubspace); Space clonedSpace = cloner.cloneSpace(srcSpace); compareSpaces(srcSpace, clonedSpace); }
@Test public void testSpaceCopyCache() { Space srcSpace = new SimpleSpace(); Space clonedSpace1 = cloner.cloneSpace(srcSpace); Space clonedSpace2 = cloner.cloneSpace(srcSpace); assertEquals(clonedSpace1, clonedSpace2); }