1 25 package org.objectweb.easybeans.tests.common.asserts; 26 27 import static org.objectweb.easybeans.tests.common.helper.InterceptorHelper.getPrintOrderErrorMsg; 28 29 import java.util.List ; 30 31 36 public class Assert extends org.testng.Assert{ 37 38 44 public static void assertEquals(final List expected, final List result, final String message) { 45 46 if (expected == null ^ result == null) { 48 throw new AssertionError (getPrintOrderErrorMsg(expected, result, message)); 49 } 50 if (expected != null) { 51 if (expected.size() == result.size()) { 53 for (int i = 0; i < expected.size(); i++) { 55 if (!(expected.get(i).equals(result.get(i)))) { 56 throw new AssertionError (getPrintOrderErrorMsg(expected, result, message)); 57 } 58 } 59 } else { 60 throw new AssertionError (getPrintOrderErrorMsg(expected, result, message)); 61 } 62 } 63 } 64 65 71 public static void assertEquals(final Object result, final Object [] expected, final String message){ 72 boolean bolIsEqual = false; 73 int i = 0; 74 75 if(expected == null){ 76 throw new AssertionError ("The args are null"); 77 } 78 79 while(!bolIsEqual && i < expected.length){ 80 if(expected[i].equals(result)){ 81 bolIsEqual = true; 82 }else{ 83 i++; 84 } 85 } 86 if(!bolIsEqual){ 87 throw new AssertionError (message); 88 } 89 } 90 } 91 | Popular Tags |