1819202122232425
* @required */ private int port; public void execute() throws MojoExecutionException { StubServer server = new StubServer(port); server.start(); }
private StubServer server; @Before public void start() { server = new StubServer().run(); RestAssured.port = server.getPort(); }
2021222324252627
1718192021222324
333435363738394041
assertTrue(server.getPort() > 0); } @Test public void shouldBePossibleToSpecifyPort() { StubServer server1 = new StubServer(8888).run(); assertEquals(8888, server1.getPort()); server1.stop(); }
4041424344454647
server1.stop(); } @Test public void shouldSelectRandomFreePortWhenDefaultOneIsBusy() { StubServer server2 = new StubServer().run(); assertTrue(server2.getPort() > server.getPort()); }
2930313233343536
public class UsingHttpsTest { private StubServer server; @Before public void start() { server = new StubServer().secured().run(); RestAssured.port = server.getPort(); }
2021222324252627282930
private StubServer server; @Before public void start() { server = new StubServer().run(); RestAssured.port = server.getPort(); whenHttp(server). match(startsWithUri("/")). then(status(HttpStatus.OK_200));