77 changed files with 1094 additions and 1173 deletions
@ -1,44 +1,35 @@ |
|||||||
package com.jayway.jsonpath; |
package com.jayway.jsonpath; |
||||||
|
|
||||||
import org.junit.Test; |
import org.junit.jupiter.params.ParameterizedTest; |
||||||
import org.junit.runner.RunWith; |
import org.junit.jupiter.params.provider.MethodSource; |
||||||
import org.junit.runners.Parameterized; |
|
||||||
|
|
||||||
import static com.jayway.jsonpath.JsonPath.using; |
import static com.jayway.jsonpath.JsonPath.using; |
||||||
import static org.assertj.core.api.Assertions.assertThat; |
import static org.assertj.core.api.Assertions.assertThat; |
||||||
|
|
||||||
@RunWith(Parameterized.class) |
|
||||||
public class JsonProviderTest extends BaseTest { |
public class JsonProviderTest extends BaseTest { |
||||||
|
|
||||||
private final Configuration conf; |
|
||||||
|
|
||||||
public JsonProviderTest(Configuration conf) { |
|
||||||
this.conf = conf; |
|
||||||
} |
|
||||||
|
|
||||||
@Parameterized.Parameters |
|
||||||
public static Iterable<Configuration> configurations() { |
public static Iterable<Configuration> configurations() { |
||||||
return Configurations.configurations(); |
return Configurations.configurations(); |
||||||
} |
} |
||||||
|
|
||||||
@Test |
|
||||||
public void strings_are_unwrapped() { |
@ParameterizedTest |
||||||
|
@MethodSource("configurations") |
||||||
|
public void strings_are_unwrapped(Configuration conf) { |
||||||
assertThat(using(conf).parse(JSON_DOCUMENT).read("$.string-property", String.class)).isEqualTo("string-value"); |
assertThat(using(conf).parse(JSON_DOCUMENT).read("$.string-property", String.class)).isEqualTo("string-value"); |
||||||
} |
} |
||||||
|
|
||||||
@Test |
|
||||||
public void integers_are_unwrapped() { |
@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); |
assertThat(using(conf).parse(JSON_DOCUMENT).read("$.int-max-property", Integer.class)).isEqualTo(Integer.MAX_VALUE); |
||||||
} |
} |
||||||
|
|
||||||
@Test |
|
||||||
public void ints_are_unwrapped() { |
@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); |
assertThat(using(conf).parse(JSON_DOCUMENT).read("$.int-max-property", int.class)).isEqualTo(Integer.MAX_VALUE); |
||||||
} |
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} |
} |
||||||
|
@ -1,47 +1,37 @@ |
|||||||
package com.jayway.jsonpath.internal.filter; |
package com.jayway.jsonpath.internal.filter; |
||||||
|
|
||||||
import com.jayway.jsonpath.BaseTest; |
import com.jayway.jsonpath.BaseTest; |
||||||
|
import org.junit.jupiter.params.ParameterizedTest; |
||||||
|
import org.junit.jupiter.params.provider.Arguments; |
||||||
|
import org.junit.jupiter.params.provider.MethodSource; |
||||||
|
|
||||||
import org.junit.Assert; |
import java.util.stream.Stream; |
||||||
import org.junit.Test; |
|
||||||
import org.junit.runner.RunWith; |
|
||||||
import org.junit.runners.Parameterized; |
|
||||||
|
|
||||||
import java.util.Arrays; |
import static org.junit.jupiter.api.Assertions.assertEquals; |
||||||
|
|
||||||
@RunWith(Parameterized.class) |
|
||||||
public class PatternFlagTest extends BaseTest { |
public class PatternFlagTest extends BaseTest { |
||||||
|
|
||||||
private final int flags; |
|
||||||
private final String expectedFlags; |
|
||||||
|
|
||||||
public PatternFlagTest(int flags, String expectedFlags) { |
@ParameterizedTest |
||||||
this.flags = flags; |
@MethodSource("testData") |
||||||
this.expectedFlags = expectedFlags; |
public void testParseFlags(int flags, String expectedFlags) { |
||||||
|
assertEquals(expectedFlags, PatternFlag.parseFlags(flags)); |
||||||
} |
} |
||||||
|
|
||||||
@Test |
public static Stream<Arguments> testData() { |
||||||
public void testParseFlags() { |
return Stream.of( |
||||||
Assert.assertEquals(expectedFlags, PatternFlag.parseFlags(flags)); |
Arguments.arguments(1, "d"), |
||||||
} |
Arguments.arguments(2, "i"), |
||||||
|
Arguments.arguments(4, "x"), |
||||||
@Parameterized.Parameters |
Arguments.arguments(8, "m"), |
||||||
public static Iterable data() { |
Arguments.arguments(32, "s"), |
||||||
return Arrays.asList( |
Arguments.arguments(64, "u"), |
||||||
new Object[][]{ |
Arguments.arguments(256, "U"), |
||||||
{ 1, "d" }, |
Arguments.arguments(300, "xmsU"), |
||||||
{ 2, "i" }, |
Arguments.arguments(13, "dxm"), |
||||||
{ 4, "x" }, |
Arguments.arguments(7, "dix"), |
||||||
{ 8, "m" }, |
Arguments.arguments(100, "xsu"), |
||||||
{ 32, "s" }, |
Arguments.arguments(367, "dixmsuU") |
||||||
{ 64, "u" }, |
|
||||||
{ 256, "U" }, |
|
||||||
{ 300, "xmsU" }, |
|
||||||
{ 13, "dxm" }, |
|
||||||
{ 7, "dix" }, |
|
||||||
{ 100, "xsu" }, |
|
||||||
{ 367, "dixmsuU" } |
|
||||||
} |
|
||||||
); |
); |
||||||
} |
} |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue