Node { public void addSource(NodeSource source) { sourceList.addSource(source); } Node(String id, String operatorName); String getId(); String getOperatorName(); void addSource(NodeSource source); NodeSource getSource(int index); NodeSource[] getSources(); DomElement getConfiguration(); void setConfiguration(DomElement configuration);  }
@Test public void testAddSource() throws Exception { final Node node = new Node("myId", "opName"); node.addSource(new NodeSource("nodeName", "source1")); node.addSource(new NodeSource("anotherName", "source2")); node.addSource(new NodeSource("thirdName", "source3")); assertEquals(3, node.getSources().length); assertEquals("nodeName", node.getSources()[0].getName()); assertEquals("anotherName", node.getSources()[1].getName()); assertEquals("thirdName", node.getSources()[2].getName()); }
@Test(expected = IllegalArgumentException.class) public void testDuplicatedSourceNodeNameNotAllowed() throws Exception { final Node node = new Node("myId", "opName"); node.addSource(new NodeSource("duplicated", "sourceNode1")); node.addSource(new NodeSource("duplicated", "sourceNode2")); }