类 OutputCapture

  • 所有已实现的接口:
    org.junit.rules.TestRule

    public class OutputCapture
    extends Object
    implements org.junit.rules.TestRule
    JUnit @Rule to capture output from System.out and System.err.
    从以下版本开始:
    1.4.0
    • 方法详细资料

      • apply

        public org.junit.runners.model.Statement apply​(org.junit.runners.model.Statement base,
                                                       org.junit.runner.Description description)
        指定者:
        apply 在接口中 org.junit.rules.TestRule
      • reset

        public void reset()
        Discard all currently accumulated output.
      • flush

        public void flush()
      • expect

        public void expect​(org.hamcrest.Matcher<? super String> matcher)
        Verify that the output is matched by the supplied matcher. Verification is performed after the test method has executed.
        参数:
        matcher - the matcher