com.github.httpmock:mock-http-server-webapp

Mock HTTP Server - Webapp

Лицензия

Лицензия

Группа

Группа

com.github.httpmock
Идентификатор

Идентификатор

mock-http-server-webapp
Последняя версия

Последняя версия

1.1.9
Дата

Дата

Тип

Тип

war
Описание

Описание

Mock HTTP Server - Webapp
Ссылка на сайт

Ссылка на сайт

https://github.com/httpmock/mock-http-server
Система контроля версий

Система контроля версий

https://github.com/httpmock/mock-http-server

Скачать mock-http-server-webapp

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.httpmock/mock-http-server-webapp/ -->
<dependency>
    <groupId>com.github.httpmock</groupId>
    <artifactId>mock-http-server-webapp</artifactId>
    <version>1.1.9</version>
    <type>war</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.httpmock/mock-http-server-webapp/
implementation 'com.github.httpmock:mock-http-server-webapp:1.1.9'
// https://jarcasting.com/artifacts/com.github.httpmock/mock-http-server-webapp/
implementation ("com.github.httpmock:mock-http-server-webapp:1.1.9")
'com.github.httpmock:mock-http-server-webapp:war:1.1.9'
<dependency org="com.github.httpmock" name="mock-http-server-webapp" rev="1.1.9">
  <artifact name="mock-http-server-webapp" type="war" />
</dependency>
@Grapes(
@Grab(group='com.github.httpmock', module='mock-http-server-webapp', version='1.1.9')
)
libraryDependencies += "com.github.httpmock" % "mock-http-server-webapp" % "1.1.9"
[com.github.httpmock/mock-http-server-webapp "1.1.9"]

Зависимости

compile (8)

Идентификатор библиотеки Тип Версия
com.github.httpmock : mock-http-server-dto jar 1.1.9
javax.ws.rs : javax.ws.rs-api jar 2.0
org.glassfish.jersey.core : jersey-server jar 2.13
com.google.code.gson : gson jar 2.3.1
commons-codec : commons-codec jar 1.4
org.apache.commons : commons-lang3 jar 3.3.2
org.codehaus.jackson : jackson-jaxrs jar 1.9.13
org.codehaus.jackson : jackson-xc jar 1.9.13

provided (2)

Идентификатор библиотеки Тип Версия
javax : javaee-api jar 7.0
javax.ejb : javax.ejb-api jar 3.2

test (3)

Идентификатор библиотеки Тип Версия
org.hamcrest : hamcrest-all jar 1.3
junit : junit jar 4.11
org.mockito : mockito-all jar 1.10.8

Модули Проекта

Данный проект не имеет модулей.

mock-http-server

Coverage Status

With this mock http server you can write integration tests for your application and mock its http based backends. This example shows an integration test which configures the mock to answer for a specific request with a specific response. It also shows how to use this mock server with junit.

import static com.github.httpmock.builder.RequestBuilder.request;
import static com.github.httpmock.builder.ResponseBuilder.response;
import static com.github.httpmock.times.ExcatlyOnce.once;
import static com.jayway.restassured.RestAssured.given;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;

import com.github.httpmock.dto.RequestDto;
import com.github.httpmock.dto.ResponseDto;
import com.jayway.restassured.response.Response;

public class ExampleIT {

	@ClassRule
	public static HttpMockServer mockServer = new HttpMockServer();

	@Rule
	public HttpMock mock = new HttpMock(mockServer);

	@Test
	public void someTest() throws Exception {
		RequestDto request = request().method("POST").url("/some/url").build();
		ResponseDto response = response().payload("data")
				.contentType("text/plain").build();
		mock.when(request).thenRespond(response);

		Response mockResponse = given().baseUri(getBaseUri())
				.basePath(mock.getRequestUrl()).post("/some/url");

		assertThat(mockResponse.getBody().asString(), is("data"));
		assertThat(mockResponse.getContentType(), is("text/plain"));
		mock.verify(request, once());
	}

	private String getBaseUri() {
		return String.format("http://localhost:%d", mockServer.getPort());
	}
}

Версии библиотеки

Версия
1.1.9
1.1.8
1.1.7
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.0