assertThat(parts.get(2).getParts().get(1).getContext(), is("image"));
}
@Test
public void some_real_content() {
StructuredDocument document = asciidoctor.readDocumentStructure(
new File("target/test-classes/contentstructure.asciidoc"),
new HashMap<String, Object>());
DocumentHeader header = document.getHeader();
assertThat(header.getDocumentTitle().getMain(), is("TODO"));
assertThat(header.getDocumentTitle().getSubtitle(), is("Document Title"));
Map<String, Object> attributes = header.getAttributes();
assertThat((String) attributes.get("type"), is("object.type"));
List<ContentPart> parts = document.getParts();
assertThat(parts, notNullValue());
assertThat(parts, hasSize(4));
assertThat(document.getPartByStyle("literal").getContent(),
is("TODO: This is description"));
List<ContentPart> images = document.getPartsByContext("image");
assertThat(images, hasSize(2));
for (int i = 0; i < 2; i++) {
assertThat((String) images.get(i).getAttributes().get("target"),
is("src/some image " + (i + 1) + ".JPG"));
assertThat((String) images.get(i).getAttributes().get("alt"),
is("TODO title" + (i + 1)));
assertThat((String) images.get(i).getAttributes().get("link"),
is("link" + (i + 1) + ".html"));
}
assertThat(document.getPartByStyle("Open").getContent(),
startsWith("<div class=\"paragraph text-center\">"));
}