org.mockserver.junit
Class ProxyRule

java.lang.Object
  extended by org.mockserver.junit.ProxyRule
All Implemented Interfaces:
org.junit.rules.TestRule

public class ProxyRule
extends Object
implements org.junit.rules.TestRule


Constructor Summary
ProxyRule(Integer port, Object target)
          Start the proxy prior to test execution and stop the proxy after the tests have completed.
ProxyRule(Integer port, Object target, boolean perTestSuite)
          Start the proxy prior to test execution and stop the proxy after the tests have completed.
ProxyRule(Object target)
          Start the proxy prior to test execution and stop the proxy after the tests have completed.
ProxyRule(Object target, boolean perTestSuite)
          Start the proxy prior to test execution and stop the proxy after the tests have completed.
 
Method Summary
 org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
           
 Integer getHttpPort()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyRule

public ProxyRule(Object target)
Start the proxy prior to test execution and stop the proxy after the tests have completed. This constructor dynamically allocates a free port for the proxy to use. Note: The getHttpPort getter can be used to retrieve the dynamically allocated port.

Parameters:
target - an instance of the test being executed

ProxyRule

public ProxyRule(Object target,
                 boolean perTestSuite)
Start the proxy prior to test execution and stop the proxy after the tests have completed. This constructor dynamically allocates a free port for the proxy to use.

Parameters:
target - an instance of the test being executed
perTestSuite - indicates how many instances of the proxy are created if true a single proxy is created per JVM if false one instance per test class is created

ProxyRule

public ProxyRule(Integer port,
                 Object target)
Start the proxy prior to test execution and stop the proxy after the tests have completed. This constructor dynamically create a proxy that accepts HTTP(S) requests on the specified port

Parameters:
port - the HTTP(S) port for the proxy
target - an instance of the test being executed

ProxyRule

public ProxyRule(Integer port,
                 Object target,
                 boolean perTestSuite)
Start the proxy prior to test execution and stop the proxy after the tests have completed. This constructor dynamically create a proxy that accepts HTTP(S) requests on the specified port

Parameters:
port - the HTTP(S) port for the proxy
target - an instance of the test being executed
perTestSuite - indicates how many instances of the proxy are created if true a single proxy is created per JVM if false one instance per test class is created
Method Detail

getHttpPort

public Integer getHttpPort()

apply

public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
                                               org.junit.runner.Description description)
Specified by:
apply in interface org.junit.rules.TestRule


Copyright © 2017. All rights reserved.