### Question:
CasDumpWriter extends CasConsumer_ImplBase { @Override public void process(CAS aCAS) throws AnalysisEngineProcessException { out.println("======== CAS " + iCas + " begin =================================="); out.println(); Iterator<CAS> viewIt = aCAS.getViewIterator(); while (viewIt.hasNext()) { CAS view = viewIt.next(); processView(view); if (view.getDocumentText() == null && view.getSofaDataStream() != null) { processSofaData(view); } } out.println("======== CAS " + iCas + " end =================================="); out.println(); out.println(); out.flush(); iCas++; }  @Override void initialize(UimaContext context); @Override void process(CAS aCAS); @Override void collectionProcessComplete(); static final String INCLUDE_PREFIX; static final String EXCLUDE_PREFIX; static final String PARAM_OUTPUT_FILE; static final String PARAM_WRITE_DOCUMENT_META_DATA; static final String PARAM_FEATURE_PATTERNS; static final String PARAM_TYPE_PATTERNS; static final String PARAM_SORT; }### Answer:
@Test public void test() throws Exception { File outputFile = new File(folder.getRoot(), "dump-output.txt"); AnalysisEngine writer = AnalysisEngineFactory.createEngine(CasDumpWriter.class, CasDumpWriter.PARAM_OUTPUT_FILE, outputFile.getPath()); JCas jcas = writer.newJCas(); CasIOUtil.readJCas(jcas, new File("src/test/resources/data/docs/test.xmi")); writer.process(jcas); assertTrue(outputFile.exists()); String reference = readFileToString( new File("src/test/resources/data/reference/test.xmi.dump"), "UTF-8").trim(); String actual = readFileToString(outputFile, "UTF-8").trim(); actual = actual.replaceAll("\r\n", "\n"); assertEquals(reference, actual); }