private Boolean getBooleanCapability ( String key ) { Object o = getRawCapabilities ( ) . get ( key ) ; if ( o == null ) { return null ; } else if ( o instanceof Boolean ) { return ( Boolean ) o ; } else if ( o instanceof String && ( "true" . equalsIgnoreCase ( ( String ) o ) || "false" . equalsIgnoreCase ( ( String ) o ) ) ) { return Boolean . valueOf ( ( String ) o ) ; } else { throw new ClassCastException ( String . format ( "DesiredCapability %s's value should be boolean: found value %s of type %s" , key , o . toString ( ) , o . getClass ( ) . getName ( ) ) ) ; } }
throws exception if user didn t pass the capability as a boolean or String parsable as boolean