Port of schuchert.wikispaces.com


JUnit_4.xAtAfter

JUnit_4.xAtAfter

@After

@After is the opposite of @Before. It is executed after each unit test. JUnit prior to version 4.0 had an equivalent method, tearDown, you could optionally define in a test class to get similar behavior. There are differences:

Here is the example:

59:     @After
60:     public void removeCreatedRateplan() {
61:         if (createdRatePlanName != null && createdRatePlanVehicleType != null) {
62:             component.removeRatePlan(createdRatePlanName, createdRatePlanVehicleType);
63:         }
64: 
65:     }

And here’s the equivalent in JUnit before 4.0.

60:     protected void tearDown() {
61:         if (createdRatePlanName != null && createdRatePlanVehicleType != null) {
62:             component.removeRatePlan(createdRatePlanName, createdRatePlanVehicleType);
63:         }
64: 
65:     }


Comments

" Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.