Search in sources :

Example 91 with DocumentContext

use of com.jayway.jsonpath.DocumentContext in project spring-cloud-open-service-broker by spring-cloud.

the class GetLastServiceOperationResponseTest method responseWithAllValuesIsBuilt.

@Test
public void responseWithAllValuesIsBuilt() {
    GetLastServiceOperationResponse response = GetLastServiceOperationResponse.builder().operationState(OperationState.SUCCEEDED).description("description").deleteOperation(true).build();
    assertThat(response.getState()).isEqualTo(OperationState.SUCCEEDED);
    assertThat(response.getDescription()).isEqualTo("description");
    assertThat(response.isDeleteOperation()).isEqualTo(true);
    DocumentContext json = JsonUtils.toJsonPath(response);
    assertThat(json).hasPath("$.state").isEqualTo(OperationState.SUCCEEDED.toString());
    assertThat(json).hasPath("$.description").isEqualTo("description");
}
Also used : DocumentContext(com.jayway.jsonpath.DocumentContext) Test(org.junit.Test)

Example 92 with DocumentContext

use of com.jayway.jsonpath.DocumentContext in project spring-cloud-open-service-broker by spring-cloud.

the class GetLastServiceOperationResponseTest method responseWithDefaultsIsBuilt.

@Test
public void responseWithDefaultsIsBuilt() {
    GetLastServiceOperationResponse response = GetLastServiceOperationResponse.builder().build();
    assertThat(response.getState()).isNull();
    assertThat(response.getDescription()).isNull();
    assertThat(response.isDeleteOperation()).isEqualTo(false);
    DocumentContext json = JsonUtils.toJsonPath(response);
    assertThat(json).hasNoPath("$.state");
    assertThat(json).hasNoPath("$.description");
}
Also used : DocumentContext(com.jayway.jsonpath.DocumentContext) Test(org.junit.Test)

Example 93 with DocumentContext

use of com.jayway.jsonpath.DocumentContext in project spring-cloud-open-service-broker by spring-cloud.

the class GetLastServiceOperationResponseTest method responseWithStateIsSerializedToJson.

private void responseWithStateIsSerializedToJson(OperationState stateValue, String stateString) {
    GetLastServiceOperationResponse response = GetLastServiceOperationResponse.builder().operationState(stateValue).description("description").build();
    DocumentContext json = JsonUtils.toJsonPath(response);
    assertThat(json).hasPath("$.state").isEqualTo(stateString);
    assertThat(json).hasPath("$.description").isEqualTo("description");
}
Also used : DocumentContext(com.jayway.jsonpath.DocumentContext)

Example 94 with DocumentContext

use of com.jayway.jsonpath.DocumentContext in project spring-cloud-open-service-broker by spring-cloud.

the class CreateServiceInstanceAppBindingResponseTest method responseWithDefaultsIsBuilt.

@Test
public void responseWithDefaultsIsBuilt() {
    CreateServiceInstanceAppBindingResponse response = CreateServiceInstanceAppBindingResponse.builder().build();
    assertThat(response.isBindingExisted()).isEqualTo(false);
    assertThat(response.getCredentials()).hasSize(0);
    assertThat(response.getSyslogDrainUrl()).isNull();
    assertThat(response.getVolumeMounts()).hasSize(0);
    DocumentContext json = JsonUtils.toJsonPath(response);
    assertThat(json).hasNoPath("$.credentials");
    assertThat(json).hasNoPath("$.syslog_drain_url");
    assertThat(json).hasNoPath("$.volume_mounts");
}
Also used : DocumentContext(com.jayway.jsonpath.DocumentContext) Test(org.junit.Test)

Example 95 with DocumentContext

use of com.jayway.jsonpath.DocumentContext in project spring-cloud-open-service-broker by spring-cloud.

the class CreateServiceInstanceRouteBindingResponseTest method responseWithDefaultsIsBuilt.

@Test
public void responseWithDefaultsIsBuilt() {
    CreateServiceInstanceRouteBindingResponse response = CreateServiceInstanceRouteBindingResponse.builder().build();
    assertThat(response.isBindingExisted()).isEqualTo(false);
    assertThat(response.getRouteServiceUrl()).isNull();
    DocumentContext json = JsonUtils.toJsonPath(response);
    assertThat(json).hasNoPath("$.route_service_url");
}
Also used : DocumentContext(com.jayway.jsonpath.DocumentContext) Test(org.junit.Test)

Aggregations

DocumentContext (com.jayway.jsonpath.DocumentContext)146 Test (org.junit.Test)106 HashMap (java.util.HashMap)14 BaseTest (com.jayway.jsonpath.BaseTest)12 Map (java.util.Map)12 PathNotFoundException (com.jayway.jsonpath.PathNotFoundException)8 JsonPath (com.jayway.jsonpath.JsonPath)7 File (java.io.File)7 List (java.util.List)7 JsonPathAssert (com.revinate.assertj.json.JsonPathAssert)6 Query (org.graylog.plugins.views.search.Query)6 MessageList (org.graylog.plugins.views.search.searchtypes.MessageList)6 Time (org.graylog.plugins.views.search.searchtypes.pivot.buckets.Time)6 Values (org.graylog.plugins.views.search.searchtypes.pivot.buckets.Values)6 DateTime (org.joda.time.DateTime)6 Configuration (com.jayway.jsonpath.Configuration)5 ArrayList (java.util.ArrayList)5 Test (org.junit.jupiter.api.Test)5 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)5 InvalidJsonException (com.jayway.jsonpath.InvalidJsonException)4