### Question:
MapNode extends Node { public List<PairNode> getEntries() { return entries; } MapNode(List<PairNode> entries); @SuppressWarnings("unchecked")  MapNode(GyroParser.MapContext context); List<PairNode> getEntries(); @Override R accept(NodeVisitor<C, R, X> visitor, C context);  }### Answer:
@Test void constructorContext() { MapNode node = (MapNode) Node.parse("{foo:1,bar:2}", GyroParser::map); List<PairNode> entries = node.getEntries(); assertThat(entries).hasSize(2); entries.forEach(entry -> assertThat(entry.getValue()).isInstanceOf(ValueNode.class)); }
@Test void getEntries() { PairNode entry0 = mock(PairNode.class); PairNode entry1 = mock(PairNode.class); MapNode node = new MapNode(Arrays.asList(entry0, entry1)); assertThat(node.getEntries()).containsExactly(entry0, entry1); }
@Test void getEntriesImmutable() { MapNode node = new MapNode(Collections.emptyList()); assertThatExceptionOfType(UnsupportedOperationException.class) .isThrownBy(() -> node.getEntries().add(mock(PairNode.class))); }