1 5 package com.mockobjects.constraint; 6 7 import java.util.Arrays ; 8 9 import com.mockobjects.dynamic.DynamicUtil; 10 11 14 public class IsEqual implements Constraint 15 { 16 private Object _object; 17 18 public IsEqual( Object equalArg) { 19 if(equalArg instanceof Object []) { 20 _object = Arrays.asList((Object [])equalArg); 21 } else { 22 _object = equalArg; 23 } 24 } 25 26 public boolean eval( Object arg ) { 27 if(arg instanceof Object []) { 28 arg = Arrays.asList((Object [])arg); 29 } 30 return arg.equals(_object); 31 } 32 33 public String toString() { 34 return " = " + DynamicUtil.proxyToString(_object); 35 } 36 37 public boolean equals(Object anObject) { 38 return eval(anObject); 39 } 40 } 41 | Popular Tags |