From: Tim P <ti...@us...> - 2008-11-04 20:59:16
|
Update of /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv18410/test/unit/org/webmacro/template Modified Files: TemplateTestCase.java Log Message: Replace assertTrue(false) idiom with fail Index: TemplateTestCase.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/TemplateTestCase.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** TemplateTestCase.java 18 Mar 2008 22:36:36 -0000 1.22 --- TemplateTestCase.java 4 Nov 2008 20:59:05 -0000 1.23 *************** *** 131,135 **** executeStringTemplate(template); if (result == null) ! assertTrue(_context.get("assertEvaluationEquals") == null); else assertTrue(result.toString(), result.equals(_context.get("assertEvaluationEquals"))); --- 131,135 ---- executeStringTemplate(template); if (result == null) ! assertNull(_context.get("assertEvaluationEquals")); else assertTrue(result.toString(), result.equals(_context.get("assertEvaluationEquals"))); *************** *** 138,145 **** protected void showError(String templateName, String resultText, String result) { ! System.err.println("/" + templateName + "/ does not " + "evaluate to /" + resultText + "/ " + "result=/" + result + "/"); - assertTrue(false); } --- 138,144 ---- protected void showError(String templateName, String resultText, String result) { ! fail("/" + templateName + "/ does not " + "evaluate to /" + resultText + "/ " + "result=/" + result + "/"); } *************** *** 183,193 **** catch (Exception e) { ! System.err.println("Execution of /" + templateText + "/" + " threw " + e.getClass() + "(" + e.getMessage() + ")" + ", expecting /" + resultText + "/"); - e.printStackTrace(); - assertTrue(false); } if (result == null) --- 182,191 ---- catch (Exception e) { ! e.printStackTrace(); ! fail("Execution of /" + templateText + "/" + " threw " + e.getClass() + "(" + e.getMessage() + ")" + ", expecting /" + resultText + "/"); } if (result == null) *************** *** 196,203 **** if (result.equals(resultText) != equals) { ! System.err.println("Execution of /" + templateText + "/" + " yielded /" + result + "/, " + (equals ? "" : " not ")+ "expecting /" + resultText + "/"); - assertTrue(false); } } --- 194,200 ---- if (result.equals(resultText) != equals) { ! fail("Execution of /" + templateText + "/" + " yielded /" + result + "/, " + (equals ? "" : " not ")+ "expecting /" + resultText + "/"); } } *************** *** 245,259 **** if (caught == null) { ! System.err.println("Execution of /" + templateText + "/" + " yielded /" + result + "/, expecting throw " + exceptionClass); - assertTrue(false); } else if (!exceptionClass.isAssignableFrom(caught.getClass())) { ! System.err.println("Execution of /" + templateText + "/" + " threw " + caught.getClass() + ", expecting " + exceptionClass); - assertTrue(false); } else if (messageMatchText != null) --- 242,254 ---- if (caught == null) { ! fail("Execution of /" + templateText + "/" + " yielded /" + result + "/, expecting throw " + exceptionClass); } else if (!exceptionClass.isAssignableFrom(caught.getClass())) { ! fail("Execution of /" + templateText + "/" + " threw " + caught.getClass() + ", expecting " + exceptionClass); } else if (messageMatchText != null) *************** *** 262,269 **** if (!re.match(caught.getMessage())) { ! System.err.println("Exception " + caught.getMessage() + " does not match /" + messageMatchText + "/"); - assertTrue(false); } } --- 257,263 ---- if (!re.match(caught.getMessage())) { ! fail("Exception " + caught.getMessage() + " does not match /" + messageMatchText + "/"); } } *************** *** 296,304 **** catch (Exception e) { ! System.err.println("Execution of /" + templateText + "/" + " threw " + e.getClass() + "/, expecting match /" + resultPattern + "/"); - e.printStackTrace(System.err); - assertTrue(false); } if (result == null) --- 290,297 ---- catch (Exception e) { ! e.printStackTrace(System.err); ! fail("Execution of /" + templateText + "/" + " threw " + e.getClass() + "/, expecting match /" + resultPattern + "/"); } if (result == null) *************** *** 308,315 **** if (!re.match(result)) { ! System.err.println("Execution of /" + templateText + "/" + " yielded /" + result + "/, expecting match /" + resultPattern + "/"); - assertTrue(false); } } --- 301,307 ---- if (!re.match(result)) { ! fail("Execution of /" + templateText + "/" + " yielded /" + result + "/, expecting match /" + resultPattern + "/"); } } *************** *** 331,338 **** if (!(caught instanceof PropertyException)) { ! System.err.println("Execution of /" + templateText + "/" + " yielded /" + caught.getClass() + "/, expecting throw PropertyException"); - assertTrue(false); } else --- 323,329 ---- if (!(caught instanceof PropertyException)) { ! fail("Execution of /" + templateText + "/" + " yielded /" + caught.getClass() + "/, expecting throw PropertyException"); } else *************** *** 343,359 **** if (caught == null) { ! System.err.println("Execution of /" + templateText + "/" + " yielded /" + result + "/, expecting throw " + "PropertyException with caught exception " + exceptionClass); - assertTrue(false); } else if (!exceptionClass.isAssignableFrom(caught.getClass())) { ! System.err.println("Execution of /" + templateText + "/" + " threw " + caught.getClass() + ", expecting throw " + "PropertyException with caught exception " + exceptionClass); - assertTrue(false); } } --- 334,348 ---- if (caught == null) { ! fail("Execution of /" + templateText + "/" + " yielded /" + result + "/, expecting throw " + "PropertyException with caught exception " + exceptionClass); } else if (!exceptionClass.isAssignableFrom(caught.getClass())) { ! fail("Execution of /" + templateText + "/" + " threw " + caught.getClass() + ", expecting throw " + "PropertyException with caught exception " + exceptionClass); } } |