private void testWrongChildTypeValidation( String jsonml, TagType type, TagType[] expected, TagType actual, int index) throws Exception { testValidation( jsonml, String.format( Validator.WRONG_CHILD_TYPE_FMT, index, type, Validator.printList(expected), actual)); }
// Used for correct statements - error message should be null private void testValidation(String jsonml) throws Exception { JsonML jsonMLRoot = JsonMLUtil.parseString(jsonml); String msg = Validator.validate(jsonMLRoot); if (msg != null) { String errorMsg = String.format("Validation error for %s.\n Received: %s\n", jsonml, msg); } }
private void testValidation(String jsonml, String expected) throws Exception { JsonML jsonMLRoot = JsonMLUtil.parseString(jsonml); String msg = Validator.validate(jsonMLRoot); if (!msg.equals(expected)) { String errorMsg = String.format( "Validation error for %s.\n Received: %s\n Expected: %s\n", jsonml, msg, expected); assertEquals(errorMsg, expected, msg); } }