@ -12,7 +12,7 @@ import java.util.List;
import static com.jayway.jsonpath.JsonPath.using ;
import static org.assertj.core.api.Assertions.assertThat ;
public class JacksonTre eJsonProviderTest extends BaseTest {
public class JacksonJsonNod eJsonProviderTest extends BaseTest {
private static final String JSON =
"[" +
@ -38,14 +38,14 @@ public class JacksonTreeJsonProviderTest extends BaseTest {
@Test
public void json_can_be_parsed ( ) {
ObjectNode node = using ( JACKSON_TRE E_CONFIGURATION ) . parse ( JSON_DOCUMENT ) . read ( "$" ) ;
ObjectNode node = using ( JACKSON_JSON_NOD E_CONFIGURATION ) . parse ( JSON_DOCUMENT ) . read ( "$" ) ;
assertThat ( node . get ( "string-property" ) . asText ( ) ) . isEqualTo ( "string-value" ) ;
}
@Test
public void strings_are_unwrapped ( ) {
JsonNode node = using ( JACKSON_TRE E_CONFIGURATION ) . parse ( JSON_DOCUMENT ) . read ( "$.string-property" ) ;
String unwrapped = using ( JACKSON_TRE E_CONFIGURATION ) . parse ( JSON_DOCUMENT ) . read ( "$.string-property" , String . class ) ;
JsonNode node = using ( JACKSON_JSON_NOD E_CONFIGURATION ) . parse ( JSON_DOCUMENT ) . read ( "$.string-property" ) ;
String unwrapped = using ( JACKSON_JSON_NOD E_CONFIGURATION ) . parse ( JSON_DOCUMENT ) . read ( "$.string-property" , String . class ) ;
assertThat ( unwrapped ) . isEqualTo ( "string-value" ) ;
assertThat ( unwrapped ) . isEqualTo ( node . asText ( ) ) ;
@ -53,16 +53,16 @@ public class JacksonTreeJsonProviderTest extends BaseTest {
@Test
public void ints_are_unwrapped ( ) {
JsonNode node = using ( JACKSON_TRE E_CONFIGURATION ) . parse ( JSON_DOCUMENT ) . read ( "$.int-max-property" ) ;
int unwrapped = using ( JACKSON_TRE E_CONFIGURATION ) . parse ( JSON_DOCUMENT ) . read ( "$.int-max-property" , int . class ) ;
JsonNode node = using ( JACKSON_JSON_NOD E_CONFIGURATION ) . parse ( JSON_DOCUMENT ) . read ( "$.int-max-property" ) ;
int unwrapped = using ( JACKSON_JSON_NOD E_CONFIGURATION ) . parse ( JSON_DOCUMENT ) . read ( "$.int-max-property" , int . class ) ;
assertThat ( unwrapped ) . isEqualTo ( Integer . MAX_VALUE ) ;
assertThat ( unwrapped ) . isEqualTo ( node . asInt ( ) ) ;
}
@Test
public void longs_are_unwrapped ( ) {
JsonNode node = using ( JACKSON_TRE E_CONFIGURATION ) . parse ( JSON_DOCUMENT ) . read ( "$.long-max-property" ) ;
long unwrapped = using ( JACKSON_TRE E_CONFIGURATION ) . parse ( JSON_DOCUMENT ) . read ( "$.long-max-property" , long . class ) ;
JsonNode node = using ( JACKSON_JSON_NOD E_CONFIGURATION ) . parse ( JSON_DOCUMENT ) . read ( "$.long-max-property" ) ;
long unwrapped = using ( JACKSON_JSON_NOD E_CONFIGURATION ) . parse ( JSON_DOCUMENT ) . read ( "$.long-max-property" , long . class ) ;
assertThat ( unwrapped ) . isEqualTo ( Long . MAX_VALUE ) ;
assertThat ( unwrapped ) . isEqualTo ( node . asLong ( ) ) ;
@ -71,7 +71,7 @@ public class JacksonTreeJsonProviderTest extends BaseTest {
@Test
public void list_of_numbers ( ) {
ArrayNode objs = using ( JACKSON_TRE E_CONFIGURATION ) . parse ( JSON_DOCUMENT ) . read ( "$.store.book[*].display-price" ) ;
ArrayNode objs = using ( JACKSON_JSON_NOD E_CONFIGURATION ) . parse ( JSON_DOCUMENT ) . read ( "$.store.book[*].display-price" ) ;
System . out . println ( objs . toString ( ) ) ;
}
@ -79,7 +79,7 @@ public class JacksonTreeJsonProviderTest extends BaseTest {
public void test_type_ref ( ) throws IOException {
TypeRef < List < FooBarBaz < Gen > > > typeRef = new TypeRef < List < FooBarBaz < Gen > > > ( ) { } ;
List < FooBarBaz < Gen > > list = using ( JACKSON_TRE E_CONFIGURATION ) . parse ( JSON ) . read ( "$" , typeRef ) ;
List < FooBarBaz < Gen > > list = using ( JACKSON_JSON_NOD E_CONFIGURATION ) . parse ( JSON ) . read ( "$" , typeRef ) ;
assertThat ( list . get ( 0 ) . gen . eric ) . isEqualTo ( "yepp" ) ;
}
@ -88,7 +88,7 @@ public class JacksonTreeJsonProviderTest extends BaseTest {
public void test_type_ref_fail ( ) throws IOException {
TypeRef < List < FooBarBaz < Integer > > > typeRef = new TypeRef < List < FooBarBaz < Integer > > > ( ) { } ;
using ( JACKSON_TRE E_CONFIGURATION ) . parse ( JSON ) . read ( "$" , typeRef ) ;
using ( JACKSON_JSON_NOD E_CONFIGURATION ) . parse ( JSON ) . read ( "$" , typeRef ) ;
}
public static class FooBarBaz < T > {