Browse Source

two more tests for Option.ALWAYS_RETURN_LIST

pull/142/head
Alexey Makeyev 9 years ago
parent
commit
03bec8af41
  1. 4
      json-path/src/test/java/com/jayway/jsonpath/OptionsTest.java

4
json-path/src/test/java/com/jayway/jsonpath/OptionsTest.java

@ -2,6 +2,7 @@ package com.jayway.jsonpath;
import org.junit.Test; import org.junit.Test;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -45,6 +46,9 @@ public class OptionsTest extends BaseTest {
Configuration conf = Configuration.builder().options(ALWAYS_RETURN_LIST).build(); Configuration conf = Configuration.builder().options(ALWAYS_RETURN_LIST).build();
assertThat(using(conf).parse("{\"foo\" : \"bar\"}").read("$.foo")).isInstanceOf(List.class); assertThat(using(conf).parse("{\"foo\" : \"bar\"}").read("$.foo")).isInstanceOf(List.class);
assertThat(using(conf).parse("{\"foo\": null}").read("$.foo")).isInstanceOf(List.class);
assertThat(using(conf).parse("{\"foo\": [1, 4, 8]}").read("$.foo")).asList()
.containsExactly(Arrays.asList(1, 4, 8));
} }
@Test @Test

Loading…
Cancel
Save