Skip to content

0.8.x Annotations for JUnit4 @Before @After

UKAI Hiroshi edited this page Oct 19, 2017 · 3 revisions

@Before

This annotation lets JCUnit know the annotated method should be run before each test method defined in enclosing class is run.

Feature Specification
name @Before
package org.junit

Target

A method. All paramaters of the method must be annotated with @From and have return no value.

Attributes

(none)

Example

      @Before
      public void before(@From("b") String b) {
        System.out.println("    before:" + b);
      }

@After

This annotation lets JCUnit know the annotated method should be run after each test method defined in enclosing class is finished.

Feature Specification
name @AfterClass
package org.junit
target A method. All paramaters of the method must be annotated with @From and have return no value.

Target

A method. All paramaters of the method must be annotated with @From and have return no value.

Attributes

(none)

Example

Clone this wiki locally