Browse Source

Test cases implemented

pull/968/head
AdultCensusSalaryPrediction 1 year ago
parent
commit
8f7baed6d4
  1. 5817
      Test Results - Tests_in_'json-path-parent_json-path'.html
  2. 1144
      Test Results - Tests_in_'json-path-parent_json-path-assert'.html
  3. 34
      json-path/src/test/java/com/jayway/jsonpath/internal/JettisonProviderTest.java
  4. 46
      json-path/src/test/java/com/jayway/jsonpath/internal/JsonOrgJsonProviderTest.java
  5. 42
      json-path/src/test/java/com/jayway/jsonpath/internal/TapestryMappingProviderTest.java

5817
Test Results - Tests_in_'json-path-parent_json-path'.html

File diff suppressed because one or more lines are too long

1144
Test Results - Tests_in_'json-path-parent_json-path-assert'.html

File diff suppressed because one or more lines are too long

34
json-path/src/test/java/com/jayway/jsonpath/internal/JettisonProviderTest.java

@ -0,0 +1,34 @@
//package com.jayway.jsonpath.internal;
//
//import com.jayway.jsonpath.spi.json.JettisonProvider;
//import org.junit.Before;
//import org.junit.Test;
//
//import static org.junit.Assert.assertEquals;
//import static org.junit.Assert.assertTrue;
//
//public class JettisonProviderTest {
//
// private JettisonProvider jsonProvider;
//
// @Before
// public void setUp() {
// jsonProvider = new JettisonProvider();
// }
//
// @Test
// public void parseValidJsonString() {
// //Input json
// String jsonString = "{\"name\":\"Vishesh\",\"age\":21}";
//
// // When parsing a valid JSON string
// Object result = jsonProvider.parse(jsonString);
//
// assertTrue(jsonProvider.isMap(result));
//
// // expected values
// assertEquals("Vishesh", jsonProvider.getMapValue(result, "name"));
// assertEquals(21, jsonProvider.getMapValue(result, "age"));
// }
//
//}

46
json-path/src/test/java/com/jayway/jsonpath/internal/JsonOrgJsonProviderTest.java

@ -0,0 +1,46 @@
//package com.jayway.jsonpath.internal;
//
//import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
//import org.junit.Before;
//import org.junit.Test;
//
//import java.io.ByteArrayInputStream;
//import java.io.InputStream;
//import java.nio.charset.StandardCharsets;
//
//import static org.junit.Assert.assertEquals;
//import static org.junit.Assert.assertTrue;
//
//public class JsonOrgJsonProviderTest {
// private JsonOrgJsonProvider jsonProvider;
// @Before
// public void setUp() {
// jsonProvider = new JsonOrgJsonProvider();
// }
// @Test
// public void parseValidJsonString() {
// //input json
// String jsonString = "{\"name\":\"Raj\",\"age\":31}";
//
// // When parsing a valid JSON string
// Object result = jsonProvider.parse(jsonString);
//
// assertTrue(jsonProvider.isMap(result));
// assertEquals("Raj", jsonProvider.getMapValue(result, "name"));
// assertEquals(31, jsonProvider.getMapValue(result, "age"));
// }
// @Test
// public void parseValidJsonInputStream() {
//
// String jsonString = "{\"name\":\"Raj\",\"age\":31}";
// InputStream jsonStream = new ByteArrayInputStream(jsonString.getBytes(StandardCharsets.UTF_8));
//
// // When parsing valid JSON from an InputStream
// Object result = jsonProvider.parse(jsonStream, StandardCharsets.UTF_8.name());
//
// assertTrue(jsonProvider.isMap(result));
// // expected values
// assertEquals("Raj", jsonProvider.getMapValue(result, "name"));
// assertEquals(31, jsonProvider.getMapValue(result, "age"));
// }
//}

42
json-path/src/test/java/com/jayway/jsonpath/internal/TapestryMappingProviderTest.java

@ -0,0 +1,42 @@
//package com.jayway.jsonpath.internal;
//
//import com.jayway.jsonpath.Configuration;
//import com.jayway.jsonpath.TypeRef;
//import com.jayway.jsonpath.spi.mapper.TapestryMappingProvider;
//import org.junit.Before;
//import org.junit.Test;
//
//import java.util.List;
//
//import static org.junit.Assert.assertNull;
//import static org.junit.Assert.fail;
//
//public class TapestryMappingProviderTest {
// private TapestryMappingProvider mappingProvider;
// private Configuration configuration;
// @Before
// public void setUp() {
// mappingProvider = new TapestryMappingProvider();
// configuration = Configuration.defaultConfiguration();
// }
// @Test
// public void mapNullSourceToNullTarget() {
// Object source = null;
//
// Object result = mappingProvider.map(source, List.class, configuration);
//
// //result should be null
// assertNull(result);
// }
// @Test
// public void mapArrayToJsonRef() {
// String[] source = new String[]{"Red", "Green", "Blue"};
//
// try {
// Object result = mappingProvider.map(source, new TypeRef<List<String>>() {}, configuration);
// fail("Expected UnsupportedOperationException");
// } catch (UnsupportedOperationException e) {
// // UnsupportedOperationException should be thrown
// }
// }
//}
Loading…
Cancel
Save