1 3 package test.jmock.core.constraint; 4 5 import org.jmock.core.constraint.IsSame; 6 7 8 public class IsSameTest extends AbstractConstraintsTest 9 { 10 public void testEvaluatesToTrueIfArgumentIsReferenceToASpecifiedObject() { 11 Object o1 = new Object (); 12 Object o2 = new Object (); 13 14 IsSame isSame = new IsSame(o1); 15 16 assertTrue(isSame.eval(o1)); 17 assertFalse(isSame.eval(o2)); 18 } 19 20 public void testReturnsReadableDescriptionFromToString() { 21 IsSame isSame = new IsSame("ARG"); 22 assertEquals("description", "same(<ARG>)", 23 isSame.describeTo(new StringBuffer ()).toString()); 24 } 25 26 public void testReturnsReadableDescriptionFromToStringWhenInitialisedWithNull() { 27 IsSame isSame = new IsSame(null); 28 assertEquals("description", "same(null)", 29 isSame.describeTo(new StringBuffer ()).toString()); 30 } 31 } 32 | Popular Tags |