-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathBaseTest.java
More file actions
160 lines (144 loc) · 6.76 KB
/
BaseTest.java
File metadata and controls
160 lines (144 loc) · 6.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
package com.jayway.jsonpath;
import com.jayway.jsonpath.internal.Path;
import com.jayway.jsonpath.internal.path.PredicateContextImpl;
import com.jayway.jsonpath.spi.json.GsonJsonProvider;
import com.jayway.jsonpath.spi.json.JacksonJsonNodeJsonProvider;
import com.jayway.jsonpath.spi.json.JacksonJsonProvider;
import com.jayway.jsonpath.spi.json.JakartaJsonProvider;
import com.jayway.jsonpath.spi.json.JettisonProvider;
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
import com.jayway.jsonpath.spi.json.JsonSmartJsonProvider;
import com.jayway.jsonpath.spi.json.TapestryJsonProvider;
import com.jayway.jsonpath.spi.mapper.GsonMappingProvider;
import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider;
import com.jayway.jsonpath.spi.mapper.JakartaMappingProvider;
import com.jayway.jsonpath.spi.mapper.JsonOrgMappingProvider;
import com.jayway.jsonpath.spi.mapper.JsonSmartMappingProvider;
import com.jayway.jsonpath.spi.mapper.TapestryMappingProvider;
import java.util.HashMap;
public class BaseTest {
public static final Configuration JSON_ORG_CONFIGURATION = Configuration
.builder()
.mappingProvider(new JsonOrgMappingProvider())
.jsonProvider(new JsonOrgJsonProvider())
.build();
public static final Configuration GSON_CONFIGURATION = Configuration
.builder()
.mappingProvider(new GsonMappingProvider())
.jsonProvider(new GsonJsonProvider())
.build();
public static final Configuration JACKSON_CONFIGURATION = Configuration
.builder()
.mappingProvider(new JacksonMappingProvider())
.jsonProvider(new JacksonJsonProvider())
.build();
public static final Configuration JACKSON_JSON_NODE_CONFIGURATION = Configuration
.builder()
.mappingProvider(new JacksonMappingProvider())
.jsonProvider(new JacksonJsonNodeJsonProvider())
.build();
public static final Configuration JETTISON_CONFIGURATION = Configuration
.builder()
.jsonProvider(new JettisonProvider())
.build();
public static final Configuration JSON_SMART_CONFIGURATION = Configuration
.builder()
.mappingProvider(new JsonSmartMappingProvider())
.jsonProvider(new JsonSmartJsonProvider())
.build();
public static final Configuration TAPESTRY_JSON_CONFIGURATION = Configuration
.builder()
.mappingProvider(new TapestryMappingProvider())
.jsonProvider(TapestryJsonProvider.INSTANCE)
.build();
public static final Configuration JAKARTA_JSON_CONFIGURATION = Configuration
.builder()
.mappingProvider(new JakartaMappingProvider())
.jsonProvider(new JakartaJsonProvider())
.build();
// extension to Jakarta EE 9 JSON-P with mutable objects and array
public static final Configuration JAKARTA_JSON_RW_CONFIGURATION = Configuration
.builder()
.mappingProvider(new JakartaMappingProvider())
.jsonProvider(new JakartaJsonProvider(true))
.build();
public static final String JSON_BOOK_DOCUMENT =
"{ " +
" \"category\" : \"reference\",\n" +
" \"author\" : \"Nigel Rees\",\n" +
" \"title\" : \"Sayings of the Century\",\n" +
" \"display-price\" : 8.95\n" +
"}";
public static final String JSON_DOCUMENT = "{\n" +
" \"string-property\" : \"string-value\", \n" +
" \"int-max-property\" : " + Integer.MAX_VALUE + ", \n" +
" \"long-max-property\" : " + Long.MAX_VALUE + ", \n" +
" \"boolean-property\" : true, \n" +
" \"null-property\" : null, \n" +
" \"int-small-property\" : 1, \n" +
" \"max-price\" : 10, \n" +
" \"store\" : {\n" +
" \"book\" : [\n" +
" {\n" +
" \"category\" : \"reference\",\n" +
" \"author\" : \"Nigel Rees\",\n" +
" \"title\" : \"Sayings of the Century\",\n" +
" \"display-price\" : 8.95\n" +
" },\n" +
" {\n" +
" \"category\" : \"fiction\",\n" +
" \"author\" : \"Evelyn Waugh\",\n" +
" \"title\" : \"Sword of Honour\",\n" +
" \"display-price\" : 12.99\n" +
" },\n" +
" {\n" +
" \"category\" : \"fiction\",\n" +
" \"author\" : \"Herman Melville\",\n" +
" \"title\" : \"Moby Dick\",\n" +
" \"isbn\" : \"0-553-21311-3\",\n" +
" \"display-price\" : 8.99\n" +
" },\n" +
" {\n" +
" \"category\" : \"fiction\",\n" +
" \"author\" : \"J. R. R. Tolkien\",\n" +
" \"title\" : \"The Lord of the Rings\",\n" +
" \"isbn\" : \"0-395-19395-8\",\n" +
" \"display-price\" : 22.99\n" +
" }\n" +
" ],\n" +
" \"bicycle\" : {\n" +
" \"foo\" : \"baz\",\n" +
" \"escape\" : \"Esc\\b\\f\\n\\r\\t\\n\\t\\u002A\",\n" +
" \"color\" : \"red\",\n" +
" \"display-price\" : 19.95,\n" +
" \"foo:bar\" : \"fooBar\",\n" +
" \"dot.notation\" : \"new\",\n" +
" \"dash-notation\" : \"dashes\"\n" +
" }\n" +
" },\n" +
" \"foo\" : \"bar\",\n" +
" \"@id\" : \"ID\"\n" +
"}";
public static String JSON_BOOK_STORE_DOCUMENT = "{\n" +
" \"store\": {\n" +
" \"book\": [\n" +
" {\n" +
" \"category\": \"reference\"\n" +
" },\n" +
" {\n" +
" \"category\": \"fiction\"\n" +
" },\n" +
" {\n" +
" \"category\": \"fiction\"\n" +
" },\n" +
" {\n" +
" \"category\": \"fiction\"\n" +
" }\n" +
" ]\n" +
" },\n" +
" \"expensive\": 10\n" +
"}";
public Predicate.PredicateContext createPredicateContext(final Object check, Option... options) {
return new PredicateContextImpl(check, check, Configuration.defaultConfiguration().setOptions(options), new HashMap<Path, Object>());
}
}