类org.springframework.boot.test.json.JsonContent源码实例Demo

下面列出了怎么用org.springframework.boot.test.json.JsonContent的API类实例代码及写法,或者点击链接到github查看源代码。

@Test
void testGetConfigFromServer() {
    final ResponseEntity<String> response = rest.getForEntity("/my-test-app/default", String.class);
    assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
    final JsonContent<?> jsonBody = json.from(response.getBody());
    System.out.println(jsonBody.getJson());
    assertThat(jsonBody).extractingJsonPathValue("$.name")
            .isEqualTo("my-test-app");
    assertThat(jsonBody).extractingJsonPathArrayValue("$.profiles")
            .containsExactly("default");
    assertThat(jsonBody).extractingJsonPathArrayValue("$.propertySources..source['info.foo']")
            .containsExactly("bar");
    assertThat(jsonBody).extractingJsonPathArrayValue("$.propertySources..source['top.secret']")
            .containsExactly("Hello World");

    final DecryptRequest expectedRequest = new DecryptRequest()
            .withCiphertextBlob(ByteBuffer.wrap(Base64.getDecoder().decode("c2VjcmV0".getBytes())));
    verify(mockKms, atLeastOnce()).decrypt(eq(expectedRequest));
}
 
源代码2 项目: find   文件: TrendingWidgetTest.java
@Override
protected void validateJson(final JsonContent<TrendingWidget> jsonContent) {
    jsonContent.assertThat()
        .hasJsonPathStringValue("$.name", "Test Widget")
        .hasJsonPathStringValue("$.type", "TrendingWidget")
        .hasJsonPathNumberValue("$.x", 1)
        .hasJsonPathNumberValue("$.y", 1)
        .hasJsonPathNumberValue("$.width", 1)
        .hasJsonPathNumberValue("$.height", 1)
        .hasJsonPathNumberValue("$.datasource.config.id", 123)
        .hasJsonPathStringValue("$.datasource.config.type", "QUERY")
        .hasJsonPathStringValue("$.widgetSettings.parametricField", "/DOCUMENT/CONTENT_TYPE")
        .hasJsonPathStringValue("$.widgetSettings.dateField", "/DOCUMENT/AUTN_DATE")
        .hasJsonPathNumberValue("$.widgetSettings.maxValues", 5)
        .hasJsonPathStringValue("$.widgetSettings.maxDate", "2010-04-05T00:00:00Z")
        .hasJsonPathStringValue("$.widgetSettings.minDate", "2009-04-05T00:00:00Z")
        .hasJsonPathNumberValue("$.widgetSettings.numberOfBuckets", 12);
}
 
@Test
public void verifySerialize() throws IOException {
	InstanceId id = InstanceId.of("test123");
	Instant timestamp = Instant.ofEpochSecond(1587751031).truncatedTo(ChronoUnit.SECONDS);
	StatusInfo statusInfo = StatusInfo.valueOf("OFFLINE", Collections.singletonMap("foo", "bar"));

	InstanceStatusChangedEvent event = new InstanceStatusChangedEvent(id, 12345678L, timestamp, statusInfo);

	JsonContent<InstanceStatusChangedEvent> jsonContent = jsonTester.write(event);
	assertThat(jsonContent).extractingJsonPathStringValue("$.instance").isEqualTo("test123");
	assertThat(jsonContent).extractingJsonPathNumberValue("$.version").isEqualTo(12345678);
	assertThat(jsonContent).extractingJsonPathNumberValue("$.timestamp").isEqualTo(1587751031.000000000);
	assertThat(jsonContent).extractingJsonPathStringValue("$.type").isEqualTo("STATUS_CHANGED");
	assertThat(jsonContent).extractingJsonPathValue("$.statusInfo").isNotNull();

	assertThat(jsonContent).extractingJsonPathStringValue("$.statusInfo.status").isEqualTo("OFFLINE");
	assertThat(jsonContent).extractingJsonPathMapValue("$.statusInfo.details").containsOnly(entry("foo", "bar"));
}
 
@Test
public void verifySerializeWithOnlyRequiredProperties() throws IOException {
	InstanceId id = InstanceId.of("test123");
	Instant timestamp = Instant.ofEpochSecond(1587751031).truncatedTo(ChronoUnit.SECONDS);
	StatusInfo statusInfo = StatusInfo.valueOf("OFFLINE");

	InstanceStatusChangedEvent event = new InstanceStatusChangedEvent(id, 0L, timestamp, statusInfo);

	JsonContent<InstanceStatusChangedEvent> jsonContent = jsonTester.write(event);
	assertThat(jsonContent).extractingJsonPathStringValue("$.instance").isEqualTo("test123");
	assertThat(jsonContent).extractingJsonPathNumberValue("$.version").isEqualTo(0);
	assertThat(jsonContent).extractingJsonPathNumberValue("$.timestamp").isEqualTo(1587751031.000000000);
	assertThat(jsonContent).extractingJsonPathStringValue("$.type").isEqualTo("STATUS_CHANGED");
	assertThat(jsonContent).extractingJsonPathValue("$.statusInfo").isNotNull();

	assertThat(jsonContent).extractingJsonPathStringValue("$.statusInfo.status").isEqualTo("OFFLINE");
	assertThat(jsonContent).extractingJsonPathMapValue("$.statusInfo.details").isEmpty();
}
 
@Test
public void verifySerializeWithOnlyRequiredProperties() throws IOException {
	InstanceId id = InstanceId.of("test123");
	Instant timestamp = Instant.ofEpochSecond(1587751031).truncatedTo(ChronoUnit.SECONDS);
	Registration registration = Registration.create("test", "http://localhost:9080/heath").build();

	InstanceRegisteredEvent event = new InstanceRegisteredEvent(id, 0L, timestamp, registration);

	JsonContent<InstanceRegisteredEvent> jsonContent = jsonTester.write(event);
	assertThat(jsonContent).extractingJsonPathStringValue("$.instance").isEqualTo("test123");
	assertThat(jsonContent).extractingJsonPathNumberValue("$.version").isEqualTo(0);
	assertThat(jsonContent).extractingJsonPathNumberValue("$.timestamp").isEqualTo(1587751031.000000000);
	assertThat(jsonContent).extractingJsonPathStringValue("$.type").isEqualTo("REGISTERED");
	assertThat(jsonContent).extractingJsonPathValue("$.registration").isNotNull();

	assertThat(jsonContent).extractingJsonPathStringValue("$.registration.name").isEqualTo("test");
	assertThat(jsonContent).extractingJsonPathStringValue("$.registration.managementUrl").isNull();
	assertThat(jsonContent).extractingJsonPathStringValue("$.registration.healthUrl")
			.isEqualTo("http://localhost:9080/heath");
	assertThat(jsonContent).extractingJsonPathStringValue("$.registration.serviceUrl").isNull();
	assertThat(jsonContent).extractingJsonPathStringValue("$.registration.source").isNull();
	assertThat(jsonContent).extractingJsonPathMapValue("$.registration.metadata").isEmpty();
}
 
@Test
public void verifySerialize() throws IOException {
	InstanceId id = InstanceId.of("test123");
	Instant timestamp = Instant.ofEpochSecond(1587751031).truncatedTo(ChronoUnit.SECONDS);
	Map<String, Object> data = new HashMap<>();
	data.put("build", Collections.singletonMap("version", "1.0.0"));
	data.put("foo", "bar");
	InstanceInfoChangedEvent event = new InstanceInfoChangedEvent(id, 12345678L, timestamp, Info.from(data));

	JsonContent<InstanceInfoChangedEvent> jsonContent = jsonTester.write(event);
	assertThat(jsonContent).extractingJsonPathStringValue("$.instance").isEqualTo("test123");
	assertThat(jsonContent).extractingJsonPathNumberValue("$.version").isEqualTo(12345678);
	assertThat(jsonContent).extractingJsonPathNumberValue("$.timestamp").isEqualTo(1587751031.000000000);
	assertThat(jsonContent).extractingJsonPathStringValue("$.type").isEqualTo("INFO_CHANGED");
	assertThat(jsonContent).extractingJsonPathMapValue("$.info").containsOnlyKeys("build", "foo");

	assertThat(jsonContent).extractingJsonPathStringValue("$.info['build'].['version']").isEqualTo("1.0.0");
	assertThat(jsonContent).extractingJsonPathStringValue("$.info['foo']").isEqualTo("bar");
}
 
@Test
public void verifySerialize() throws IOException {
	InstanceId id = InstanceId.of("test123");
	Instant timestamp = Instant.ofEpochSecond(1587751031).truncatedTo(ChronoUnit.SECONDS);
	Endpoints endpoints = Endpoints.single("info", "http://localhost:8080/info").withEndpoint("health",
			"http://localhost:8080/health");
	InstanceEndpointsDetectedEvent event = new InstanceEndpointsDetectedEvent(id, 12345678L, timestamp, endpoints);

	JsonContent<InstanceEndpointsDetectedEvent> jsonContent = jsonTester.write(event);
	assertThat(jsonContent).extractingJsonPathStringValue("$.instance").isEqualTo("test123");
	assertThat(jsonContent).extractingJsonPathNumberValue("$.version").isEqualTo(12345678);
	assertThat(jsonContent).extractingJsonPathNumberValue("$.timestamp").isEqualTo(1587751031.000000000);
	assertThat(jsonContent).extractingJsonPathStringValue("$.type").isEqualTo("ENDPOINTS_DETECTED");
	assertThat(jsonContent).extractingJsonPathArrayValue("$.endpoints").hasSize(2);

	assertThat(jsonContent).extractingJsonPathStringValue("$.endpoints[0].id").isIn("info", "health");
	assertThat(jsonContent).extractingJsonPathStringValue("$.endpoints[0].url").isIn("http://localhost:8080/info",
			"http://localhost:8080/health");

	assertThat(jsonContent).extractingJsonPathStringValue("$.endpoints[1].id").isIn("info", "health");
	assertThat(jsonContent).extractingJsonPathStringValue("$.endpoints[1].url").isIn("http://localhost:8080/info",
			"http://localhost:8080/health");
}
 
@Test
public void verifySerializeWithOnlyRequiredProperties() throws IOException {
	InstanceId id = InstanceId.of("test123");
	Instant timestamp = Instant.ofEpochSecond(1587751031).truncatedTo(ChronoUnit.SECONDS);
	Registration registration = Registration.create("test", "http://localhost:9080/heath").build();

	InstanceRegistrationUpdatedEvent event = new InstanceRegistrationUpdatedEvent(id, 0L, timestamp, registration);

	JsonContent<InstanceRegistrationUpdatedEvent> jsonContent = jsonTester.write(event);
	assertThat(jsonContent).extractingJsonPathStringValue("$.instance").isEqualTo("test123");
	assertThat(jsonContent).extractingJsonPathNumberValue("$.version").isEqualTo(0);
	assertThat(jsonContent).extractingJsonPathNumberValue("$.timestamp").isEqualTo(1587751031.000000000);
	assertThat(jsonContent).extractingJsonPathStringValue("$.type").isEqualTo("REGISTRATION_UPDATED");
	assertThat(jsonContent).extractingJsonPathValue("$.registration").isNotNull();

	assertThat(jsonContent).extractingJsonPathStringValue("$.registration.name").isEqualTo("test");
	assertThat(jsonContent).extractingJsonPathStringValue("$.registration.managementUrl").isNull();
	assertThat(jsonContent).extractingJsonPathStringValue("$.registration.healthUrl")
			.isEqualTo("http://localhost:9080/heath");
	assertThat(jsonContent).extractingJsonPathStringValue("$.registration.serviceUrl").isNull();
	assertThat(jsonContent).extractingJsonPathStringValue("$.registration.source").isNull();
	assertThat(jsonContent).extractingJsonPathMapValue("$.registration.metadata").isEmpty();
}
 
源代码9 项目: spring-boot-admin   文件: EndpointsMixinTest.java
@Test
public void verifySerialize() throws IOException {
	Endpoints endpoints = Endpoints.single("info", "http://localhost:8080/info").withEndpoint("health",
			"http://localhost:8080/health");

	JsonContent<Endpoints> jsonContent = jsonTester.write(endpoints);
	assertThat(jsonContent).extractingJsonPathArrayValue("$").hasSize(2);

	assertThat(jsonContent).extractingJsonPathStringValue("$[0].id").isIn("info", "health");
	assertThat(jsonContent).extractingJsonPathStringValue("$[0].url").isIn("http://localhost:8080/info",
			"http://localhost:8080/health");

	assertThat(jsonContent).extractingJsonPathStringValue("$[1].id").isIn("info", "health");
	assertThat(jsonContent).extractingJsonPathStringValue("$[1].url").isIn("http://localhost:8080/info",
			"http://localhost:8080/health");
}
 
@Test
public void testSerialize() throws Exception {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    InfoDTO infoDTO = new InfoDTO("JSON测试应用", "1.0.0", sdf.parse("2019-01-01 12:00:00"));
    JsonContent<InfoDTO> jsonContent = json.write(infoDTO);
    log.info("json content: {}", jsonContent.getJson());
    // 或者使用基于JSON path的校验
    assertThat(jsonContent).hasJsonPathStringValue("@.appName");
    assertThat(jsonContent).extractingJsonPathStringValue("@.appName").isEqualTo("JSON测试应用");
    assertThat(jsonContent).hasJsonPathStringValue("@.version");
    assertThat(jsonContent).extractingJsonPathStringValue("@.version").isEqualTo("1.0.0");
    assertThat(jsonContent).hasJsonPathStringValue("@.date");
    assertThat(jsonContent).extractingJsonPathStringValue("@.date").isEqualTo("2019-01-01 12:00:00");
}
 
源代码11 项目: blog-tutorials   文件: CarDetailsJsonTest.java
@Test
public void testSerialize() throws Exception {
  CarDetails carDetails = new CarDetails("Audi", "A3", "gray");
  JsonContent<CarDetails> result = this.json.write(carDetails);
  System.out.println(result);
  assertThat(result).extractingJsonPathStringValue("$.type").contains("Audi", "A3", "gray");
}
 
源代码12 项目: blog-tutorials   文件: UserDetailsJsonTest.java
@Test
public void testSerialize() throws Exception {

  UserDetails userDetails = new UserDetails(1L, "Duke", "Java",
    LocalDate.of(1995, 1, 1), true);

  JsonContent<UserDetails> result = this.json.write(userDetails);

  assertThat(result).hasJsonPathStringValue("$.firstname");
  assertThat(result).extractingJsonPathStringValue("$.firstname").isEqualTo("Duke");
  assertThat(result).extractingJsonPathStringValue("$.lastname").isEqualTo("Java");
  assertThat(result).extractingJsonPathStringValue("$.dateofbirth").isEqualTo("01.01.1995");
  assertThat(result).doesNotHaveJsonPath("$.enabled");
}
 
源代码13 项目: find   文件: HodConfigTest.java
@Override
    protected void validateJson(final JsonContent<HodConfig> jsonContent) {
        jsonContent.assertThat().hasJsonPathStringValue("@.activeIndexes[0].domain", ResourceName.WIKI_CHI.getDomain());
        jsonContent.assertThat().hasJsonPathStringValue("@.activeIndexes[0].name", ResourceName.WIKI_CHI.getName());
        jsonContent.assertThat().hasJsonPathBooleanValue("@.publicIndexesEnabled", true);
//        jsonContent.assertThat().hasJsonPathStringValue("@.apiKey", "api-key-abc"); TODO: see other to-do comment below
        jsonContent.assertThat().hasJsonPathStringValue("@.ssoPageGetUrl", "https://dev.havenapps.io/sso.html");
        jsonContent.assertThat().hasJsonPathStringValue("@.ssoPagePostUrl", "https://dev.havenapps.io/sso");
        jsonContent.assertThat().hasJsonPathStringValue("@.endpointUrl", "https://api.int.havenondemand.com");
    }
 
源代码14 项目: find   文件: TimeLastRefreshedWidgetTest.java
@Override
protected void validateJson(final JsonContent<TimeLastRefreshedWidget> jsonContent) {
    jsonContent.assertThat()
            .hasJsonPathStringValue("$.name", "Test Widget")
            .hasJsonPathStringValue("$.type", "TimeLastRefreshedWidget")
            .hasJsonPathNumberValue("$.x", 1)
            .hasJsonPathNumberValue("$.y", 1)
            .hasJsonPathNumberValue("$.width", 1)
            .hasJsonPathNumberValue("$.height", 1)
            .hasJsonPathStringValue("$.widgetSettings.dateFormat", "HH:mm z")
            .hasJsonPathStringValue("$.widgetSettings.timeZone", "Europe/London")
            .hasJsonPathStringValue("$.widgetSettings.testing", "testing");
}
 
源代码15 项目: find   文件: StaticContentWidgetTest.java
@Override
protected void validateJson(final JsonContent<StaticContentWidget> jsonContent) {
    jsonContent.assertThat()
        .hasJsonPathStringValue("$.name", "Test Widget")
        .hasJsonPathStringValue("$.type", "StaticContentWidget")
        .hasJsonPathNumberValue("$.x", 1)
        .hasJsonPathNumberValue("$.y", 1)
        .hasJsonPathNumberValue("$.width", 1)
        .hasJsonPathNumberValue("$.height", 1)
        .hasJsonPathStringValue("$.widgetSettings.html", "Hello World!")
        .hasJsonPathStringValue("$.widgetSettings.testing", "testing");
}
 
源代码16 项目: find   文件: SunburstWidgetTest.java
@Override
protected void validateJson(final JsonContent<SunburstWidget> jsonContent) {
    jsonContent.assertThat()
            .hasJsonPathStringValue("$.name", "Test Widget")
            .hasJsonPathStringValue("$.type", "SunburstWidget")
            .hasJsonPathNumberValue("$.x", 1)
            .hasJsonPathNumberValue("$.y", 1)
            .hasJsonPathNumberValue("$.width", 1)
            .hasJsonPathNumberValue("$.height", 1)
            .hasJsonPathNumberValue("$.datasource.config.id", 123)
            .hasJsonPathStringValue("$.datasource.config.type", "QUERY")
            .hasJsonPathStringValue("$.widgetSettings.firstField", "CONTENT_TYPE")
            .hasJsonPathNumberValue("$.widgetSettings.maxLegendEntries", 5);
}
 
源代码17 项目: find   文件: CurrentTimeWidgetTest.java
@Override
protected void validateJson(final JsonContent<CurrentTimeWidget> jsonContent) {
    jsonContent.assertThat()
            .hasJsonPathStringValue("$.name", "Test Widget")
            .hasJsonPathStringValue("$.type", "CurrentTimeWidget")
            .hasJsonPathNumberValue("$.x", 1)
            .hasJsonPathNumberValue("$.y", 1)
            .hasJsonPathNumberValue("$.width", 1)
            .hasJsonPathNumberValue("$.height", 1)
            .hasJsonPathStringValue("$.widgetSettings.dateFormat", "ll")
            .hasJsonPathStringValue("$.widgetSettings.timeFormat", "HH:mm z")
            .hasJsonPathStringValue("$.widgetSettings.timeZone", "Europe/London")
            .hasJsonPathStringValue("$.widgetSettings.testing", "testing");
}
 
源代码18 项目: find   文件: TopicMapWidgetTest.java
@Override
protected void validateJson(final JsonContent<TopicMapWidget> jsonContent) {
    jsonContent.assertThat()
            .hasJsonPathStringValue("$.name", "Test Widget")
            .hasJsonPathStringValue("$.type", "TopicMapWidget")
            .hasJsonPathNumberValue("$.x", 1)
            .hasJsonPathNumberValue("$.y", 1)
            .hasJsonPathNumberValue("$.width", 1)
            .hasJsonPathNumberValue("$.height", 1)
            .hasJsonPathNumberValue("$.datasource.config.id", 123)
            .hasJsonPathStringValue("$.datasource.config.type", "QUERY");
}
 
源代码19 项目: find   文件: VideoWidgetTest.java
@Override
protected void validateJson(final JsonContent<VideoWidget> jsonContent) {
    jsonContent.assertThat()
            .hasJsonPathStringValue("$.name", "Test Widget")
            .hasJsonPathStringValue("$.type", "VideoWidget")
            .hasJsonPathNumberValue("$.x", 1)
            .hasJsonPathNumberValue("$.y", 1)
            .hasJsonPathNumberValue("$.width", 1)
            .hasJsonPathNumberValue("$.height", 1)
            .hasJsonPathNumberValue("$.datasource.config.id", 123)
            .hasJsonPathStringValue("$.datasource.config.type", "QUERY");
}
 
源代码20 项目: find   文件: StaticImageWidgetTest.java
@Override
protected void validateJson(final JsonContent<StaticImageWidget> jsonContent) {
    jsonContent.assertThat()
        .hasJsonPathStringValue("$.name", "Test Widget")
        .hasJsonPathStringValue("$.type", "StaticContentWidget")
        .hasJsonPathNumberValue("$.x", 1)
        .hasJsonPathNumberValue("$.y", 1)
        .hasJsonPathNumberValue("$.width", 1)
        .hasJsonPathNumberValue("$.height", 1)
        .hasJsonPathStringValue("$.widgetSettings.url", "http://placehold.it/800x300")
        .hasJsonPathStringValue("$.widgetSettings.testing", "testing");
}
 
源代码21 项目: find   文件: MapWidgetTest.java
@Override
protected void validateJson(final JsonContent<MapWidget> jsonContent) {
    jsonContent.assertThat()
            .hasJsonPathStringValue("$.name", "Test Widget")
            .hasJsonPathStringValue("$.type", "MapWidget")
            .hasJsonPathNumberValue("$.x", 1)
            .hasJsonPathNumberValue("$.y", 1)
            .hasJsonPathNumberValue("$.width", 1)
            .hasJsonPathNumberValue("$.height", 1)
            .hasJsonPathNumberValue("$.datasource.config.id", 123)
            .hasJsonPathStringValue("$.datasource.config.type", "QUERY");
}
 
源代码22 项目: find   文件: SimpleWidgetTest.java
@Override
protected void validateJson(final JsonContent<SimpleWidget> jsonContent) {
    jsonContent.assertThat()
            .hasJsonPathStringValue("$.name", "Test Widget")
            .hasJsonPathStringValue("$.type", "StaticContentWidget")
            .hasJsonPathNumberValue("$.x", 1)
            .hasJsonPathNumberValue("$.y", 1)
            .hasJsonPathNumberValue("$.width", 1)
            .hasJsonPathNumberValue("$.height", 1)
            .hasJsonPathStringValue("$.displayWidgetName", "always")
            .hasJsonPathNumberValue("$.datasource.config.id", 123)
            .hasJsonPathStringValue("$.datasource.config.type", "QUERY")
            .hasJsonPathStringValue("$.widgetSettings.content", "Hello World!");
}
 
源代码23 项目: find   文件: ResultsListWidgetTest.java
@Override
protected void validateJson(final JsonContent<ResultsListWidget> jsonContent) {
    jsonContent.assertThat()
            .hasJsonPathStringValue("$.name", "Test Widget")
            .hasJsonPathStringValue("$.type", "ResultsListWidget")
            .hasJsonPathNumberValue("$.x", 1)
            .hasJsonPathNumberValue("$.y", 1)
            .hasJsonPathNumberValue("$.width", 1)
            .hasJsonPathNumberValue("$.height", 1)
            .hasJsonPathNumberValue("$.datasource.config.id", 123)
            .hasJsonPathStringValue("$.datasource.config.type", "QUERY");
}
 
源代码24 项目: find   文件: DashboardTest.java
@Override
protected void validateJson(final JsonContent<Dashboard> jsonContent) {
    jsonContent.assertThat()
        .hasJsonPathStringValue("$.dashboardName", "My First Dashboard")
        .hasJsonPathBooleanValue("$.enabled", true)
        .hasJsonPathNumberValue("$.width", 5)
        .hasJsonPathNumberValue("$.height", 5)
        .doesNotHaveEmptyJsonPathValue("$.widgets");
}
 
源代码25 项目: find   文件: CustomApplicationsConfigTest.java
@Override
protected void validateJson(final JsonContent<CustomApplication> jsonContent) {
    jsonContent.assertThat()
            .hasJsonPathStringValue("$.applicationName", "Application name")
            .hasJsonPathStringValue("$.url", "http://example.url.com")
            .hasJsonPathStringValue("$.icon", "hp-monitor")
            .hasJsonPathBooleanValue("$.openInNewTab", true)
            .hasJsonPathBooleanValue("$.enabled", true);
}
 
源代码26 项目: find   文件: TrendingConfigurationTest.java
@Override
protected void validateJson(final JsonContent<TrendingConfiguration> jsonContent) {
    jsonContent.assertThat()
        .hasJsonPathStringValue("$.dateField", ParametricValuesService.AUTN_DATE_FIELD)
        .hasJsonPathNumberValue("$.numberOfValues", 10)
        .hasJsonPathNumberValue("$.maxNumberOfBuckets", 20)
        .hasJsonPathNumberValue("$.minNumberOfBuckets", 10)
        .hasJsonPathNumberValue("$.defaultNumberOfBuckets", 15);
}
 
源代码27 项目: find   文件: UiCustomizationTest.java
@Override
protected void validateJson(final JsonContent<UiCustomization> jsonContent) {
    jsonContent.assertThat().hasJsonPathBooleanValue("@.options.option3.user", false);
    jsonContent.assertThat().hasJsonPathStringValue("@.parametricOrder[0]", "FIELD_Y");
    jsonContent.assertThat().hasJsonPathStringValue("@.parametricOrder[1]", "FIELD_X");
    jsonContent.assertThat().hasJsonPathStringValue("@.specialUrlPrefixes.['application/vnd.visio']", "ms-visio:ofv|u|");
    jsonContent.assertThat().hasJsonPathStringValue("@.errorCallSupportString", "Custom technical support message");
}
 
源代码28 项目: find   文件: PowerPointConfigTest.java
@Override
protected void validateJson(final JsonContent<PowerPointConfig> jsonContent) {
    jsonContent.assertThat().hasJsonPathNumberValue("@.marginLeft", 0.1);
    jsonContent.assertThat().hasJsonPathNumberValue("@.marginRight", 0.1);
    jsonContent.assertThat().hasJsonPathNumberValue("@.marginTop", 0.1);
    jsonContent.assertThat().hasJsonPathNumberValue("@.marginBottom", 0.1);
}
 
源代码29 项目: find   文件: ExportConfigTest.java
@Override
protected void validateJson(final JsonContent<ExportConfig> jsonContent) {
    jsonContent.assertThat().hasJsonPathNumberValue("@.powerpoint.marginLeft", 0.1);
    jsonContent.assertThat().hasJsonPathNumberValue("@.powerpoint.marginRight", 0.1);
    jsonContent.assertThat().hasJsonPathNumberValue("@.powerpoint.marginTop", 0.1);
    jsonContent.assertThat().hasJsonPathNumberValue("@.powerpoint.marginBottom", 0.1);
}
 
源代码30 项目: find   文件: TemplatesConfigTest.java
@Override
protected void validateJson(final JsonContent<TemplatesConfig> jsonContent) {
    jsonContent.assertThat().hasJsonPathStringValue("@.searchResult[0].file", "some_file.tmpl");
    jsonContent.assertThat().hasJsonPathStringValue("@.searchResult[0].triggers[0].field", "some_idol_field");
    jsonContent.assertThat().hasJsonPathStringValue("@.searchResult[0].triggers[0].values[0]", "some_value");
    jsonContent.assertThat().hasJsonPathStringValue("@.searchResult[0].triggers[1].field", "some_other_idol_field");
    jsonContent.assertThat().hasJsonPathStringValue("@.searchResult[0].triggers[1].values[0]", "some_value");
    jsonContent.assertThat().hasJsonPathStringValue("@.searchResult[0].triggers[1].values[1]", "some_other_value");jsonContent.assertThat().hasJsonPathStringValue("@.searchResult[0].file", "some_file.tmpl");
    jsonContent.assertThat().hasJsonPathStringValue("@.previewPanel[0].triggers[0].field", "some_idol_field");
    jsonContent.assertThat().hasJsonPathStringValue("@.previewPanel[0].triggers[0].values[0]", "some_value");
    jsonContent.assertThat().hasJsonPathStringValue("@.previewPanel[0].triggers[1].field", "some_other_idol_field");
    jsonContent.assertThat().hasJsonPathStringValue("@.previewPanel[0].triggers[1].values[0]", "some_value");
    jsonContent.assertThat().hasJsonPathStringValue("@.previewPanel[0].triggers[1].values[1]", "some_other_value");
}
 
 类所在包
 同包方法