### Question:
ListNode extends Node { public List<Node> getItems() { return items; } ListNode(List<Node> items);  ListNode(GyroParser.ListContext context); List<Node> getItems(); @Override R accept(NodeVisitor<C, R, X> visitor, C context);  }### Answer:
@Test void constructorContext() { ListNode node = (ListNode) Node.parse("['foo', 'bar']", GyroParser::list); List<Node> items = node.getItems(); assertThat(items).hasSize(2); items.forEach(item -> assertThat(item).isInstanceOf(ValueNode.class)); assertThat(((ValueNode) items.get(0)).getValue()).isEqualTo("foo"); assertThat(((ValueNode) items.get(1)).getValue()).isEqualTo("bar"); }
@Test void getItems() { Node item0 = mock(Node.class); Node item1 = mock(Node.class); ListNode node = new ListNode(Arrays.asList(item0, item1)); assertThat(node.getItems()).containsExactly(item0, item1); }
@Test void getItemsImmutable() { ListNode node = new ListNode(Collections.emptyList()); assertThatExceptionOfType(UnsupportedOperationException.class) .isThrownBy(() -> node.getItems().add(mock(Node.class))); }