@Override protected final boolean matchesSafely(final Value value, final Description mismatchDescription) { if (value.getValueType() != Value.TYPE.ARRAY) { mismatchDescription.appendText("was of type " + value.getValueType()); return false; } @SuppressWarnings("unchecked") // this cast is safe - see the implementation fo value.getValueType() List<Value> list = (List<Value>) value; if (!matcher.matches(list)) { matcher.describeMismatch(list, mismatchDescription); return false; } return true; }
@Override protected final boolean matchesSafely(final Value value, final Description mismatchDescription) { if (value.getValueType() != Value.TYPE.ARRAY) { mismatchDescription.appendText("was of type " + value.getValueType()); return false; } @SuppressWarnings("unchecked") // this cast is safe - see the implementation fo value.getValueType() List<Value> list = (List<Value>) value; if (!matcher.matches(list)) { matcher.describeMismatch(list, mismatchDescription); return false; } return true; }
@Override protected boolean matchesSafely(final Value item, final Description mismatchDescription) { Value actualValue = item.get(key); if (actualValue == null) { mismatchDescription.appendText("no property with key '" + key + "'"); return false; } if (actualValue.getValueType() != Value.TYPE.STRING) { mismatchDescription.appendText("property with key '" + key + "' is '" + actualValue.getValueType() + "'"); return false; } if (!value.equals(actualValue.getString())) { mismatchDescription.appendText("property with key '" + key + "' had value of '" + actualValue.getString() + "'"); return false; } return true; }
@Override protected boolean matchesSafely(final Value item, final Description mismatchDescription) { Value actualValue = item.get(key); if (actualValue == null) { mismatchDescription.appendText("no property with key '" + key + "'"); return false; } if (actualValue.getValueType() != Value.TYPE.STRING) { mismatchDescription.appendText("property with key '" + key + "' is '" + actualValue.getValueType() + "'"); return false; } if (!value.equals(actualValue.getString())) { mismatchDescription.appendText("property with key '" + key + "' had value of '" + actualValue.getString() + "'"); return false; } return true; }