org.mockserver.maven
Class StopProxyTestListener

java.lang.Object
  extended by org.junit.runner.notification.RunListener
      extended by org.mockserver.maven.StopProxyTestListener

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
org.junit.runner.notification.RunListener.ThreadSafe
 
Constructor Summary
StopProxyTestListener()
           
 
Method Summary
 void testRunFinished(org.junit.runner.Result result)
           
 
Methods inherited from class org.junit.runner.notification.RunListener
testAssumptionFailure, testFailure, testFinished, testIgnored, testRunStarted, testStarted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StopProxyTestListener

public StopProxyTestListener()
Method Detail

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.