svn commit: r915389 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/test/GenericTestCaseBase.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r915389 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/test/GenericTestCaseBase.java

doogie-3
Author: doogie
Date: Tue Feb 23 15:41:40 2010
New Revision: 915389

URL: http://svn.apache.org/viewvc?rev=915389&view=rev
Log:
Some methods for verifying two objects for inequality.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/test/GenericTestCaseBase.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/test/GenericTestCaseBase.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/test/GenericTestCaseBase.java?rev=915389&r1=915388&r2=915389&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/test/GenericTestCaseBase.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/test/GenericTestCaseBase.java Tue Feb 23 15:41:40 2010
@@ -74,6 +74,31 @@
         }
     }
 
+    public static <T> void assertNotEquals(Object wanted, Object got) {
+        assertNotEquals(null, wanted, got);
+    }
+
+    public static <T> void assertNotEquals(String msg, Object wanted, Object got) {
+        if (wanted == null) {
+            if (got != null) {
+                return;
+            }
+            failEquals(msg, wanted, got);
+        } else if (wanted.equals(got)) {
+            failEquals(msg, wanted, got);
+        }
+    }
+
+    private static void failEquals(String msg, Object wanted, Object got) {
+        StringBuilder sb = new StringBuilder();
+        if (msg != null) {
+            sb.append(msg).append(' ');
+        }
+        sb.append(" expected value: ").append(wanted);
+        sb.append(" actual value: ").append(got);
+        fail(sb.toString());
+    }
+
     public static <T> void assertEquals(List<T> wanted, Object got) {
         assertEquals(null, wanted, got);
     }