Class FluentTestRule

  • All Implemented Interfaces:
    org.junit.rules.TestRule

    public class FluentTestRule
    extends Object
    implements org.junit.rules.TestRule
    Equivalent of TestWatcher, but stop process if exception occurs on starting method call.

    It also supports After annotations.

    • Constructor Summary

      Constructors 
      Constructor Description
      FluentTestRule​(Object target)
      Creates a new fluent test rule.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.junit.runners.model.Statement apply​(org.junit.runners.model.Statement base, org.junit.runner.Description description)  
      protected void failed​(Throwable e, org.junit.runner.Description description)
      Invoked when a test fails
      protected void finished​(org.junit.runner.Description description)
      Invoked when a test method finishes (whether passing or failing)
      protected void starting​(org.junit.runner.Description description)
      Invoked when a test is about to start
      protected void succeeded​(org.junit.runner.Description description)
      Invoked when a test succeeds.
    • Constructor Detail

      • FluentTestRule

        public FluentTestRule​(Object target)
        Creates a new fluent test rule.
        Parameters:
        target - target of the rule.
    • Method Detail

      • apply

        public org.junit.runners.model.Statement apply​(org.junit.runners.model.Statement base,
                                                       org.junit.runner.Description description)
        Specified by:
        apply in interface org.junit.rules.TestRule
      • succeeded

        protected void succeeded​(org.junit.runner.Description description)
        Invoked when a test succeeds.
        Parameters:
        description - test description
      • failed

        protected void failed​(Throwable e,
                              org.junit.runner.Description description)
        Invoked when a test fails
        Parameters:
        e - exception
        description - test description
      • starting

        protected void starting​(org.junit.runner.Description description)
        Invoked when a test is about to start
        Parameters:
        description - test description
      • finished

        protected void finished​(org.junit.runner.Description description)
        Invoked when a test method finishes (whether passing or failing)
        Parameters:
        description - test description