1 3 package test.jmock.expectation; 4 5 import java.util.Vector ; 6 import org.jmock.expectation.ExpectationSet; 7 import org.jmock.expectation.MapEntry; 8 9 10 public class ExpectationSetTest extends AbstractTestExpectationCollection 11 { 12 13 protected void setUp() throws Exception { 14 super.setUp(); 15 myExpectation = new ExpectationSet(getClass().getName()); 16 } 17 18 20 public void testMultiUnsorted() { 21 myExpectation.addExpectedMany(new String []{"A", "B"}); 22 23 myExpectation.addActualMany(new String []{"A", "B"}); 24 25 myExpectation.verify(); 26 } 27 28 public void testChangingHashcode() { 29 final Vector value = new Vector (); 30 31 myExpectation.addExpected(new MapEntry("key", value)); 32 myExpectation.addActual(new MapEntry("key", value)); 33 34 value.add(getName()); 35 36 myExpectation.verify(); 37 } 38 39 public void testChanginHashcodeImediateCheck() { 40 final Vector value = new Vector (); 41 42 myExpectation.addExpected(new MapEntry("key", value)); 43 value.add(getName()); 44 myExpectation.addActual(new MapEntry("key", value)); 45 46 myExpectation.verify(); 47 } 48 49 public void testMultiUnsortedSet() { 50 myExpectation.addExpectedMany(new String []{"A", "B"}); 51 52 myExpectation.addActualMany(new String []{"A", "B", "A", "B"}); 53 54 myExpectation.verify(); 55 } 56 57 public void testUnsorted() { 58 myExpectation.addExpected("A"); 59 myExpectation.addExpected("B"); 60 61 myExpectation.addActual("B"); 62 myExpectation.addActual("A"); 63 64 myExpectation.verify(); 65 } 66 67 public void testUnsortedSet() { 68 myExpectation.addExpected("A"); 69 myExpectation.addExpected("B"); 70 71 myExpectation.addActual("A"); 72 myExpectation.addActual("B"); 73 myExpectation.addActual("A"); 74 myExpectation.addActual("B"); 75 76 myExpectation.verify(); 77 } 78 } 79 | Popular Tags |