1 16 package org.apache.commons.jelly.tags.junit; 17 18 import org.apache.commons.jelly.xpath.XPathTagSupport; 19 20 27 public abstract class AssertTagSupport extends XPathTagSupport { 28 29 public AssertTagSupport() { 30 } 31 32 35 38 protected void fail(String message) throws JellyAssertionFailedError { 39 throw new JellyAssertionFailedError(message); 40 } 41 42 45 protected void fail(String message, String detail) throws JellyAssertionFailedError { 46 if (message == null || message.length() == 0) { 47 fail(detail); 48 } 49 else { 50 fail(message + ". Assertion failed while " + detail); 51 } 52 } 53 54 57 protected void failNotEquals(String message, Object expected, Object actual, String expressions) throws JellyAssertionFailedError { 58 String formatted= ""; 59 if (message != null) { 60 formatted = message +" "; 61 } 62 fail(formatted + "expected:[" + expected + "] but was:[" + actual + "]" + expressions); 63 } 64 65 } 66 | Popular Tags |