@Test
public void testRecursiveEmbedded() throws Exception {

	TikaDocument tikaDocument = extractor.extract(Paths.get(getClass().getResource("/documents/recursive_embedded.docx").getPath()));
	/* we have to use a spewer and not just extract and check the structure of the tikaDocument
	 because the principle is to stream the embedded documents to avoid mounting all the documents in memory.
	 That could be an issue for big documents like mailboxes, zips or tarballs.
	 see https://cwiki.apache.org/confluence/display/tika/RecursiveMetadata#Jukka.27s_RecursiveMetadata_Parser
	 "A downside to the wrapper is that it breaks the Tika goal of streaming output"
	 so we just use a print stream spewer and check that all the tree has been parsed */
	ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
	new PrintStreamSpewer(new PrintStream(outputStream), new FieldNames()).write(tikaDocument);
	String allContents = new String(outputStream.toByteArray());
	assertThat(allContents).contains("embed_0");
	assertThat(allContents).contains("embed_1a");
	assertThat(allContents).contains("embed_1b");
	assertThat(allContents).contains("embed_2a");
	assertThat(allContents).contains("embed_2b");
	assertThat(allContents).contains("embed_3");
	assertThat(allContents).contains("dissolve the political bands");
	assertThat(allContents).contains("embed_4");
}