Skip to content

Commit 6f2b821

Browse files
committed
Add smoke tests
1 parent 8b7dc8b commit 6f2b821

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package io.jenkins.plugins.jsonpath;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
5+
import org.junit.jupiter.api.Test;
6+
7+
import com.jayway.jsonpath.Configuration;
8+
import com.jayway.jsonpath.JsonPath;
9+
10+
public class JsonPathSmokeTest {
11+
12+
public static class Person {
13+
public String name;
14+
public int age;
15+
public String city;
16+
}
17+
18+
@Test
19+
public void smokeTest() throws Exception {
20+
String json = "{\"name\":\"John\", \"age\":30, \"city\":\"New York\"}";
21+
22+
String name = JsonPath.read(json, "$.name");
23+
int age = JsonPath.read(json, "$.age");
24+
String city = JsonPath.read(json, "$.city");
25+
26+
assertEquals("John", name);
27+
assertEquals(30, age);
28+
assertEquals("New York", city);
29+
30+
Person person = JsonPath.using(Configuration.defaultConfiguration()).parse(json).read("$", Person.class);
31+
assertEquals("John", person.name);
32+
assertEquals(30, person.age);
33+
assertEquals("New York", person.city);
34+
35+
}
36+
37+
}

0 commit comments

Comments
 (0)