public class StopProxyTestListener
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.StopProxyTestListener</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.StopProxyTestListener</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 Class Summary
Nested classes/interfaces inherited from class org.junit.runner.notification.RunListener