### Question:
NumNode2 implements Node2 { @Override public int calc() { return value; } NumNode2(int value); @Override int calc(); @Override void print(Writer out); final int value; }### Answer:
@Test public void testCalc() throws Exception { Node2 node1 = new NumNode2(2); Node2 node2 = new NumNode2(3); Node2 node3 = new AddNode2(node1, node2); Node2 node4 = new NumNode2(4); Node2 node5 = new AddNode2(node3, node4); int actual = node5.calc(); int expected = 2 + 3 + 4; assertThat(actual, is(expected)); }