use of com.github.dreamhead.moco.Runnable in project moco by dreamhead.
the class ActualHttpServerTest method should_throw_exception_for_merging_http_server_with_any_handler_one_side.
@Test(expected = HttpResponseException.class)
public void should_throw_exception_for_merging_http_server_with_any_handler_one_side() throws Exception {
HttpServer mergedServer = ((ActualHttpServer) anotherServer).mergeServer((ActualHttpServer) httpServer);
running(mergedServer, new Runnable() {
@Override
public void run() throws Exception {
helper.get(remoteUrl("/bar/anything"));
}
});
}
use of com.github.dreamhead.moco.Runnable in project moco by dreamhead.
the class ActualHttpServerTest method should_merge_http_server_with_different_port.
@Test
public void should_merge_http_server_with_different_port() throws Exception {
httpServer = httpServer(12306, context("/foo"));
anotherServer = httpServer(12307, context("/bar"));
final HttpServer mergedServer = ((ActualHttpServer) anotherServer).mergeServer((ActualHttpServer) httpServer);
running(mergedServer, new Runnable() {
@Override
public void run() throws Exception {
assertThat(mergedServer.port(), is(12307));
}
});
}
use of com.github.dreamhead.moco.Runnable in project moco by dreamhead.
the class ActualHttpServerTest method should_merge_http_server_without_port_for_second_server.
@Test
public void should_merge_http_server_without_port_for_second_server() throws Exception {
httpServer = httpServer(context("/foo"));
anotherServer = httpServer(12307, context("/bar"));
final HttpServer mergedServer = ((ActualHttpServer) anotherServer).mergeServer((ActualHttpServer) httpServer);
running(mergedServer, new Runnable() {
@Override
public void run() throws Exception {
assertThat(mergedServer.port(), is(12307));
}
});
}
use of com.github.dreamhead.moco.Runnable in project moco by dreamhead.
the class ActualHttpServerTest method should_merge_http_server_with_any_handler_other_side.
@Test
public void should_merge_http_server_with_any_handler_other_side() throws Exception {
HttpServer mergedServer = ((ActualHttpServer) httpServer).mergeServer((ActualHttpServer) anotherServer);
running(mergedServer, new Runnable() {
@Override
public void run() throws Exception {
assertThat(helper.get(remoteUrl("/foo/anything")), is("foo"));
}
});
}
use of com.github.dreamhead.moco.Runnable in project moco by dreamhead.
the class ActualHttpServerTest method should_merge_two_https_servers.
@Test
public void should_merge_two_https_servers() throws Exception {
httpServer = httpsServer(12306, DEFAULT_CERTIFICATE, context("/foo"));
httpServer.response("foo");
anotherServer = httpsServer(12306, DEFAULT_CERTIFICATE, context("/bar"));
anotherServer.request(by(uri("/bar"))).response("bar");
HttpServer mergedServer = ((ActualHttpServer) anotherServer).mergeServer((ActualHttpServer) httpServer);
running(mergedServer, new Runnable() {
@Override
public void run() throws Exception {
assertThat(helper.get(remoteHttpsUrl("/foo/anything")), is("foo"));
assertThat(helper.get(remoteHttpsUrl("/bar/bar")), is("bar"));
}
});
}
Aggregations