### Question:
SubProcessPropertyWriter extends MultipleInstanceActivityPropertyWriter implements ElementContainer { public void addChildElement(BasePropertyWriter p) { p.setParent(this); Processes.addChildElement( p, childElements, process, simulationParameters, itemDefinitions, rootElements); } SubProcessPropertyWriter(SubProcess process, VariableScope variableScope, Set<DataObject> dataObjects); void addChildElement(BasePropertyWriter p); @Override Collection<BasePropertyWriter> getChildElements(); BasePropertyWriter getChildElement(String id); @Override void addChildEdge(BPMNEdge edge); void setDescription(String value); void setSimulationSet(SimulationSet simulations); void setProcessVariables(BaseProcessVariables processVariables); void addLaneSet(Collection<LanePropertyWriter> lanes); void setOnEntryAction(OnEntryAction onEntryAction); void setOnExitAction(OnExitAction onExitAction); void setAsync(Boolean isAsync); void setSlaDueDate(SLADueDate slaDueDate); @Override void setAbsoluteBounds(Node<? extends View, ?> node);  }### Answer:
@Test public void addChildElement() { SubProcess process = (SubProcess) propertyWriter.getElement(); List<FlowElement> flowElements = new ArrayList<>(); when(process.getFlowElements()).thenReturn(flowElements); BoundaryEventPropertyWriter boundaryEventPropertyWriter = new BoundaryEventPropertyWriter(bpmn2.createBoundaryEvent(), variableScope, new HashSet<>()); UserTaskPropertyWriter userTaskPropertyWriter = new UserTaskPropertyWriter(bpmn2.createUserTask(), variableScope, new HashSet<>()); propertyWriter.addChildElement(boundaryEventPropertyWriter); propertyWriter.addChildElement(userTaskPropertyWriter); assertThat(process.getFlowElements().get(0)).isEqualTo(userTaskPropertyWriter.getFlowElement()); assertThat(process.getFlowElements().get(1)).isEqualTo(boundaryEventPropertyWriter.getFlowElement()); }
@Test public void addChildElement() { SubProcess process = (SubProcess) propertyWriter.getElement(); when(process.getFlowElements()).thenReturn(ECollections.newBasicEList()); BoundaryEventPropertyWriter boundaryEventPropertyWriter = new BoundaryEventPropertyWriter(bpmn2.createBoundaryEvent(), variableScope, new HashSet<>()); UserTaskPropertyWriter userTaskPropertyWriter = new UserTaskPropertyWriter(bpmn2.createUserTask(), variableScope, new HashSet<>()); propertyWriter.addChildElement(boundaryEventPropertyWriter); propertyWriter.addChildElement(userTaskPropertyWriter); assertThat(process.getFlowElements().get(0)).isEqualTo(userTaskPropertyWriter.getFlowElement()); assertThat(process.getFlowElements().get(1)).isEqualTo(boundaryEventPropertyWriter.getFlowElement()); }