Write W3C capabilities into firstMatch entity instead of alwaysMatch by mykola-mokhnach · Pull Request #1010 · appium/java-client

Expand Up @@ -194,6 +194,7 @@ private void validate() throws IOException { throw new IllegalArgumentException("First match w3c capabilities is zero length"); }
//noinspection ResultOfMethodCallIgnored firsts.stream() .peek(map -> { Set<String> overlap = Sets.intersection(always.keySet(), map.keySet()); Expand Down Expand Up @@ -256,14 +257,12 @@ public void writeTo(Appendable appendable) throws IOException { json.name(CAPABILITIES); json.beginObject();
json.name(ALWAYS_MATCH); getW3C().forEach(json::write);
// Then write everything into the w3c payload. Because of the way we do this, it's easiest // to just populate the "firstMatch" section. The spec says it's fine to omit the // "alwaysMatch" field, so we do this. json.name(FIRST_MATCH); json.beginArray(); //noinspection unchecked json.beginObject(); json.endObject(); getW3C().forEach(json::write); json.endArray();
json.endObject(); // Close "capabilities" object Expand Down Expand Up @@ -291,7 +290,7 @@ private void writeMetaData(JsonOutput out) throws IOException {
default: out.name(name); out.write(input.<Object>read(Object.class)); out.write(input.read(Object.class)); break; } } Expand Down Expand Up @@ -437,8 +436,7 @@ public Object setValue(Object value) { return null; }
Map<String, Object> toReturn = new TreeMap<>(); toReturn.putAll(capabilities); Map<String, Object> toReturn = new TreeMap<>(capabilities);
// Platform name if (capabilities.containsKey(PLATFORM) && !capabilities.containsKey(PLATFORM_NAME)) { Expand Down