|
22 | 22 | import org.openqa.selenium.Capabilities;
|
23 | 23 | import org.openqa.selenium.Cookie;
|
24 | 24 | import org.openqa.selenium.Platform;
|
| 25 | +import org.openqa.selenium.logging.LogType; |
| 26 | +import org.openqa.selenium.logging.LoggingPreferences; |
25 | 27 |
|
26 | 28 | import java.util.Collections;
|
27 | 29 | import java.util.Date;
|
28 | 30 | import java.util.HashMap;
|
29 | 31 | import java.util.List;
|
30 | 32 | import java.util.Map;
|
31 | 33 | import java.util.concurrent.TimeUnit;
|
| 34 | +import java.util.logging.Level; |
32 | 35 |
|
33 | 36 | import static org.hamcrest.Matchers.equalTo;
|
34 | 37 | import static org.hamcrest.Matchers.hasEntry;
|
@@ -159,7 +162,8 @@ public void testShouldUseAMapToRepresentComplexObjects() throws Exception {
|
159 | 162 | toModel.addProperty("thing", "hairy");
|
160 | 163 | toModel.addProperty("hairy", "true");
|
161 | 164 |
|
162 |
| - Map<?,?> modelled = (Map<?,?>) new JsonToBeanConverter().convert(Object.class, toModel.toString()); |
| 165 | + Map<?,?> modelled = (Map<?,?>) new JsonToBeanConverter().convert(Object.class, |
| 166 | + toModel.toString()); |
163 | 167 | assertEquals(2, modelled.size());
|
164 | 168 | }
|
165 | 169 |
|
@@ -244,7 +248,7 @@ public void testShouldConvertObjectsInArraysToMaps() throws Exception {
|
244 | 248 | private void assertMapEntry(Map<?,?> map, String key, Object expected) {
|
245 | 249 | assertTrue("Missing key: " + key, map.containsKey(key));
|
246 | 250 | assertEquals("Wrong value for key: " + key + ": " + map.get(key).getClass().getName(),
|
247 |
| - expected, map.get(key)); |
| 251 | + expected, map.get(key)); |
248 | 252 | }
|
249 | 253 |
|
250 | 254 | @Test
|
@@ -296,6 +300,29 @@ public void testShouldConvertCapabilitiesToAMapAndIncludeCustomValues() throws E
|
296 | 300 | assertEquals("fishy", converted.getCapability("furrfu"));
|
297 | 301 | }
|
298 | 302 |
|
| 303 | + @Test |
| 304 | + public void testShouldParseCapabilitiesWithLoggingPreferences() throws Exception { |
| 305 | + JsonObject prefs = new JsonObject(); |
| 306 | + prefs.addProperty("browser", "WARNING"); |
| 307 | + prefs.addProperty("client", "DEBUG"); |
| 308 | + prefs.addProperty("driver", "ALL"); |
| 309 | + prefs.addProperty("server", "OFF"); |
| 310 | + |
| 311 | + JsonObject caps = new JsonObject(); |
| 312 | + caps.add(CapabilityType.LOGGING_PREFS, prefs); |
| 313 | + |
| 314 | + Capabilities converted = new JsonToBeanConverter() |
| 315 | + .convert(Capabilities.class, caps.toString()); |
| 316 | + |
| 317 | + LoggingPreferences lp = |
| 318 | + (LoggingPreferences) converted.getCapability(CapabilityType.LOGGING_PREFS); |
| 319 | + assertNotNull(lp); |
| 320 | + assertEquals(Level.WARNING, lp.getLevel(LogType.BROWSER)); |
| 321 | + assertEquals(Level.FINE, lp.getLevel(LogType.CLIENT)); |
| 322 | + assertEquals(Level.ALL, lp.getLevel(LogType.DRIVER)); |
| 323 | + assertEquals(Level.OFF, lp.getLevel(LogType.SERVER)); |
| 324 | + } |
| 325 | + |
299 | 326 | @Test
|
300 | 327 | public void testShouldNotParseQuotedJsonObjectsAsActualJsonObjects() {
|
301 | 328 | JsonObject inner = new JsonObject();
|
|
0 commit comments