Package org.apache.uima.fit.testing.util

Examples of org.apache.uima.fit.testing.util.HideOutput


  public void testOtherViewAware() throws ResourceInitializationException,
          AnalysisEngineProcessException {
    AnalysisEngineDescription description = AnalysisEngineFactory.createEngineDescription(
            SofaAwareAnnotator.class, typeSystemDescription);
    AnalysisEngine engine = AnalysisEngineFactory.createEngine(description, "myView");
    HideOutput hider = new HideOutput();
    engine.process(jCas);
    hider.restoreOutput();
  }
View Full Code Here


      uoe = e;
    }
    assertNotNull(uoe);
    cr.close();

    HideOutput hideOutput = new HideOutput();
    cr = CollectionReaderFactory.createReader(SingleFileXReader.class,
            typeSystemDescription, SingleFileXReader.PARAM_XML_SCHEME, "XCAS",
            SingleFileXReader.PARAM_FILE_NAME, "test/data/docs/bad.xcas");
    RuntimeException re = null;
    try {
      new JCasIterator(cr).next();
    } catch (RuntimeException e) {
      re = e;
    }
    assertNotNull(re);
    hideOutput.restoreOutput();

    cr = CollectionReaderFactory.createReader(SingleFileXReader.class,
            typeSystemDescription, SingleFileXReader.PARAM_XML_SCHEME, "XMI",
            SingleFileXReader.PARAM_FILE_NAME, "test/data/docs/dne.xmi");
    re = null;
View Full Code Here

  public void testOtherViewAware() throws ResourceInitializationException,
          AnalysisEngineProcessException {
    AnalysisEngineDescription description = AnalysisEngineFactory.createEngineDescription(
            SofaAwareAnnotator.class, typeSystemDescription);
    AnalysisEngine engine = AnalysisEngineFactory.createEngine(description, "myView");
    HideOutput hider = new HideOutput();
    engine.process(jCas);
    hider.restoreOutput();
  }
View Full Code Here

    ByteArrayOutputStream stringErr = new ByteArrayOutputStream();
    System.setOut(new PrintStream(stringOut));
    System.setErr(new PrintStream(stringErr));
    try {
      // check that nothing is written to stdout or stderr while hidden
      HideOutput ho = new HideOutput();
      System.out.print(message);
      System.err.print(message);
      Assert.assertEquals("", stringOut.toString());
      Assert.assertEquals("", stringErr.toString());

      // check that data is again written to stdout and stderr after restoring
      ho.restoreOutput();
      System.out.print(message);
      System.err.print(message);
      Assert.assertEquals(message, stringOut.toString());
      Assert.assertEquals(message, stringErr.toString());
    }
View Full Code Here

TOP

Related Classes of org.apache.uima.fit.testing.util.HideOutput

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.