KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > jmock > core > constraint > IsSameTest


1 /* Copyright (c) 2000-2004 jMock.org
2  */

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 JavaDoc o1 = new Object JavaDoc();
12         Object JavaDoc o2 = new Object JavaDoc();
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 JavaDoc()).toString());
24     }
25
26     public void testReturnsReadableDescriptionFromToStringWhenInitialisedWithNull() {
27         IsSame isSame = new IsSame(null);
28         assertEquals("description", "same(null)",
29                      isSame.describeTo(new StringBuffer JavaDoc()).toString());
30     }
31 }
32
Popular Tags