33
33
* <ul>
34
34
* <li>browserName
35
35
* <li>browserVersion
36
- * <li>platform
36
+ * <li>platformName
37
37
* </ul>
38
38
* Then the {@code stereotype} must contain the same values.
39
39
* </ul>
@@ -53,14 +53,13 @@ public boolean matches(Capabilities stereotype, Capabilities capabilities) {
53
53
// Platform matching is special, we do it below
54
54
.filter (name -> !"platform" .equalsIgnoreCase (name ) && !"platformName" .equalsIgnoreCase (name ))
55
55
.map (name -> {
56
- Object value = capabilities .getCapability (name );
57
- boolean matches ;
58
- if (value instanceof String ) {
59
- matches = stereotype .getCapability (name ).toString ().equalsIgnoreCase (value .toString ());
56
+ if (capabilities .getCapability (name ) instanceof String ) {
57
+ return stereotype .getCapability (name ).toString ()
58
+ .equalsIgnoreCase (capabilities .getCapability (name ).toString ());
60
59
} else {
61
- matches = value == null || Objects .equals (stereotype .getCapability (name ), value );
60
+ return capabilities .getCapability (name ) == null ||
61
+ Objects .equals (stereotype .getCapability (name ), capabilities .getCapability (name ));
62
62
}
63
- return matches ;
64
63
})
65
64
.reduce (Boolean ::logicalAnd )
66
65
.orElse (false );
@@ -71,7 +70,7 @@ public boolean matches(Capabilities stereotype, Capabilities capabilities) {
71
70
72
71
// Simple browser, browserVersion and platformName match
73
72
boolean browserNameMatch =
74
- capabilities .getBrowserName () == null ||
73
+ ( capabilities .getBrowserName () == null || capabilities . getBrowserName (). isEmpty ()) ||
75
74
Objects .equals (stereotype .getBrowserName (), capabilities .getBrowserName ());
76
75
boolean browserVersionMatch =
77
76
(capabilities .getBrowserVersion () == null || capabilities .getBrowserVersion ().isEmpty ()) ||
0 commit comments