AbstractBinaryMatcher implements Matcher { @Override public final boolean matches(Parameter parameter, Object value, Object... properties) { if (properties.length != 2) { throw new InvalidArgumentException( "Expected two values to be passed to operator " + parameter.getOperator().getName() + " at " + parameter.getPath()); } return matches(parameter, value, properties[0], properties[1]); }  @Override final boolean matches(Parameter parameter, Object value, Object... properties); @Override boolean isApplicableTo(Class<?> parameterType, Class<?>... propertiesTypes);  }
@Test(expectedExceptions = InvalidArgumentException.class, expectedExceptionsMessageRegExp = ".*x.y.z.*") public void testWhenHasLessThanTwoParameters() { final NotMatchingBinaryMatcher matcher = new NotMatchingBinaryMatcher(); matcher.matches(new ImmutableParameter("x.y.z", null, null, new ImmutableOperator("sample", 2, null)), new Object()); }
@Test(expectedExceptions = InvalidArgumentException.class, expectedExceptionsMessageRegExp = ".*x.y.z.*") public void testWhenHasMoreThanTwoParameters() { final NotMatchingBinaryMatcher matcher = new NotMatchingBinaryMatcher(); matcher.matches(new ImmutableParameter("x.y.z", null, null, new ImmutableOperator("sample", 2, null)), new Object(), new Object(), new Object(), new Object()); }
@Test public void testWhenHasTwoParameters() { final NotMatchingBinaryMatcher matcher = new NotMatchingBinaryMatcher(); matcher.matches(new ImmutableParameter("x.y.z", null, null, new ImmutableOperator("sample", 2, null)), new Object(), new Object[]{new Object(), new Object()}); }