org.mockserver.maven
Class StopMockServerTestListener
java.lang.Object
org.junit.runner.notification.RunListener
org.mockserver.maven.StopMockServerTestListener
public class StopMockServerTestListener
- extends org.junit.runner.notification.RunListener
- Author:
- jamesdbloom
Used to guarantee that the MockServer is stopped even when tests fail.
As maven does not run any phases are a the test or integration-test phase
when a test fails this class can be used to guarantee that the MockServer
is stopped, for example:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<properties>
<property>
<name>listener</name>
<value>org.mockserver.maven.StopMockServerTestListener</value>
</property>
</properties>
</configuration>
</plugin>
or:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<configuration>
<properties>
<property>
<name>listener</name>
<value>org.mockserver.maven.StopMockServerTestListener</value>
</property>
</properties>
</configuration>
</plugin>
This will only work if the mockserver-maven-plugin dependency is also added:
<dependencies>
...
<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-maven-plugin</artifactId>
<version>${mockserver.version}</version>
<scope>test</scope>
</dependency>
...
</dependencies>
| Nested classes/interfaces inherited from class org.junit.runner.notification.RunListener |
org.junit.runner.notification.RunListener.ThreadSafe |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StopMockServerTestListener
public StopMockServerTestListener()
testRunStarted
public void testRunStarted(org.junit.runner.Description description)
throws Exception
- Overrides:
testRunStarted in class org.junit.runner.notification.RunListener
- Throws:
Exception
testStarted
public void testStarted(org.junit.runner.Description description)
throws Exception
- Overrides:
testStarted in class org.junit.runner.notification.RunListener
- Throws:
Exception
testFinished
public void testFinished(org.junit.runner.Description description)
throws Exception
- Overrides:
testFinished in class org.junit.runner.notification.RunListener
- Throws:
Exception
testFailure
public void testFailure(org.junit.runner.notification.Failure failure)
throws Exception
- Overrides:
testFailure in class org.junit.runner.notification.RunListener
- Throws:
Exception
testAssumptionFailure
public void testAssumptionFailure(org.junit.runner.notification.Failure failure)
- Overrides:
testAssumptionFailure in class org.junit.runner.notification.RunListener
testIgnored
public void testIgnored(org.junit.runner.Description description)
throws Exception
- Overrides:
testIgnored in class org.junit.runner.notification.RunListener
- Throws:
Exception
testRunFinished
public void testRunFinished(org.junit.runner.Result result)
throws Exception
- Overrides:
testRunFinished in class org.junit.runner.notification.RunListener
- Throws:
Exception
Copyright © 2017. All rights reserved.