StmtsDocList implements Iterable<StmtsDoc> { public List<StmtsDoc> getStmtDocs(String tagFilter) { TagFilter tf = new TagFilter(tagFilter); return getStmtDocs().stream() .filter(tf::matchesTagged) .collect(Collectors.toList()); } StmtsDocList(RawStmtsDocList rawStmtsDocList); List<StmtsDoc> getStmtDocs(String tagFilter); List<StmtsDoc> getStmtDocs(); List<StmtDef> getStmts(); List<StmtDef> getStmts(String tagFilterSpec); @Override Iterator<StmtsDoc> iterator(); Map<String,String> getDocBindings();  }
@Test public void testBlocksInheritDocData() { assertThat(doclist).isNotNull(); assertThat(doclist.getStmtDocs()).hasSize(2); StmtsDoc doc1 = doclist.getStmtDocs().get(0); assertThat(doc1.getBlocks()).hasSize(1); StmtsBlock doc1block0 = doc1.getBlocks().get(0); assertThat(doc1.getTags()).isEqualTo(doc0tags); assertThat(doc1.getBindings()).isEqualTo(doc0bindings); assertThat(doc1.getParams()).isEqualTo(doc0params); assertThat(doc1block0.getName()).isEqualTo("doc1--block0"); assertThat(doc1block0.getBindings()).containsExactly(MapEntry.entry("b2","b2d"),MapEntry.entry("b1","b1d")); assertThat(doc1block0.getParams()).containsExactly(MapEntry.entry("param1","value1")); assertThat(doc1block0.getTags()).containsExactly(MapEntry.entry("atagname","atagvalue")); }
@Test public void testBlockLayersDocData() { StmtsDoc doc1 = doclist.getStmtDocs().get(1); StmtsBlock block0 = doc1.getBlocks().get(0); Map<String, String> doc1block0tags = block0.getTags(); Map<String, String> doc1block0params = block0.getParams(); Map<String, String> doc1block0bindings = block0.getBindings(); assertThat(doc1block0tags).hasSize(3); assertThat(doc1block0tags).containsOnly( MapEntry.entry("root1","val1"), MapEntry.entry("root2","val2"), MapEntry.entry("block1tag","tag-value1")); assertThat(doc1block0params).containsOnly( MapEntry.entry("foobar","baz"), MapEntry.entry("timeout","23423")); assertThat(doc1block0bindings).containsOnly( MapEntry.entry("b12","b12d"), MapEntry.entry("b11","override-b11"), MapEntry.entry("foobar","overized-beez")); }