15
15
// specific language governing permissions and limitations
16
16
// under the License.
17
17
18
- package org .openqa .selenium .remote ;
18
+ package org .openqa .selenium .json ;
19
19
20
20
import static org .hamcrest .Matchers .equalTo ;
21
21
import static org .hamcrest .Matchers .hasEntry ;
34
34
import com .google .gson .JsonObject ;
35
35
import com .google .gson .JsonPrimitive ;
36
36
37
+ import org .junit .Assert ;
37
38
import org .junit .Test ;
38
39
import org .junit .runner .RunWith ;
39
40
import org .junit .runners .JUnit4 ;
44
45
import org .openqa .selenium .Proxy ;
45
46
import org .openqa .selenium .logging .LogType ;
46
47
import org .openqa .selenium .logging .LoggingPreferences ;
48
+ import org .openqa .selenium .remote .CapabilityType ;
49
+ import org .openqa .selenium .remote .Command ;
50
+ import org .openqa .selenium .remote .DesiredCapabilities ;
51
+ import org .openqa .selenium .remote .DriverCommand ;
52
+ import org .openqa .selenium .remote .ErrorCodes ;
53
+ import org .openqa .selenium .remote .Response ;
54
+ import org .openqa .selenium .remote .SessionId ;
47
55
48
56
import java .util .Collections ;
49
57
import java .util .Date ;
@@ -140,7 +148,7 @@ public void testShouldProperlyFillInACapabilitiesObject() throws Exception {
140
148
capabilities .setJavascriptEnabled (true );
141
149
String text = new BeanToJsonConverter ().convert (capabilities );
142
150
143
- DesiredCapabilities readCapabilities =
151
+ Capabilities readCapabilities =
144
152
new JsonToBeanConverter ().convert (DesiredCapabilities .class , text );
145
153
146
154
assertEquals (capabilities , readCapabilities );
@@ -165,16 +173,18 @@ public void testShouldUseAMapToRepresentComplexObjects() throws Exception {
165
173
toModel .addProperty ("thing" , "hairy" );
166
174
toModel .addProperty ("hairy" , "true" );
167
175
168
- Map <?,?> modelled = (Map <?,?>) new JsonToBeanConverter ().convert (Object .class ,
169
- toModel .toString ());
176
+ Map <?,?> modelled = (Map <?,?>) new JsonToBeanConverter ().convert (
177
+ Object .class ,
178
+ toModel .toString ());
170
179
assertEquals (2 , modelled .size ());
171
180
}
172
181
173
182
@ Test
174
183
public void testShouldConvertAResponseWithAnElementInIt () throws Exception {
175
184
String json =
176
185
"{\" value\" :{\" value\" :\" \" ,\" text\" :\" \" ,\" selected\" :false,\" enabled\" :true,\" id\" :\" three\" },\" context\" :\" con\" ,\" sessionId\" :\" sess\" }" ;
177
- Response converted = new JsonToBeanConverter ().convert (Response .class , json );
186
+ Response
187
+ converted = new JsonToBeanConverter ().convert (Response .class , json );
178
188
179
189
Map <?,?> value = (Map <?,?>) converted .getValue ();
180
190
assertEquals ("three" , value .get ("id" ));
@@ -277,7 +287,7 @@ public void testShouldBeAbleToReconsituteASessionId() throws Exception {
277
287
public void testShouldBeAbleToConvertACommand () throws Exception {
278
288
SessionId sessionId = new SessionId ("session id" );
279
289
Command original = new Command (sessionId , DriverCommand .NEW_SESSION ,
280
- new HashMap <String , String >() {
290
+ new HashMap <String , String >() {
281
291
{
282
292
put ("food" , "cheese" );
283
293
}
@@ -387,7 +397,7 @@ public void testShouldRecognizeNumericStatus() {
387
397
.convert (Response .class , "{\" status\" :0,\" value\" :\" cheese\" }" );
388
398
389
399
assertEquals (0 , response .getStatus ().intValue ());
390
- assertEquals (new ErrorCodes ().toState (0 ), response .getState ());
400
+ Assert . assertEquals (new ErrorCodes ().toState (0 ), response .getState ());
391
401
String value = (String ) response .getValue ();
392
402
assertEquals ("cheese" , value );
393
403
}
0 commit comments