JsonPath仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1 KiB

package com.jayway.jsonpath;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import static com.jayway.jsonpath.JsonPath.using;
import static org.assertj.core.api.Assertions.assertThat;
public class JsonProviderTest extends BaseTest {
public static Iterable<Configuration> configurations() {
return Configurations.configurations();
}
@ParameterizedTest
@MethodSource("configurations")
public void strings_are_unwrapped(Configuration conf) {
assertThat(using(conf).parse(JSON_DOCUMENT).read("$.string-property", String.class)).isEqualTo("string-value");
}
@ParameterizedTest
@MethodSource("configurations")
public void integers_are_unwrapped(Configuration conf) {
assertThat(using(conf).parse(JSON_DOCUMENT).read("$.int-max-property", Integer.class)).isEqualTo(Integer.MAX_VALUE);
}
@ParameterizedTest
@MethodSource("configurations")
public void ints_are_unwrapped(Configuration conf) {
assertThat(using(conf).parse(JSON_DOCUMENT).read("$.int-max-property", int.class)).isEqualTo(Integer.MAX_VALUE);
}
}