### Question:
Calclurator3 { public int calc(Node3 node) { if (node instanceof AddNode3) { AddNode3 addNode3 = (AddNode3) node; return calc(addNode3.left) + calc(addNode3.right); } else if (node instanceof NumNode3) { NumNode3 numNode3 = (NumNode3) node; return numNode3.value; } throw new IllegalArgumentException(String.valueOf(node)); }  int calc(Node3 node);  }### Answer:
@Test public void testCalc() throws Exception { Node3 node1 = new NumNode3(2); Node3 node2 = new NumNode3(3); Node3 node3 = new AddNode3(node1, node2); Node3 node4 = new NumNode3(4); Node3 node5 = new AddNode3(node3, node4); Calclurator3 calclurator = new Calclurator3(); int actual = calclurator.calc(node5); int expected = 2 + 3 + 4; assertThat(actual, is(expected)); }