1 3 package org.jmock.examples.website; 4 5 import org.jmock.Mock; 6 import org.jmock.MockObjectTestCase; 7 import org.jmock.core.stub.DefaultResultStub; 8 9 10 public class BeanPropertyGetterMatcherTest extends MockObjectTestCase 11 { 12 private DefaultResultStub returnDefaultValue = new DefaultResultStub(); 13 private BeanPropertyGetterMatcher beanPropertyGetters = new BeanPropertyGetterMatcher(); 14 15 public void testCanMatchPropertyGetters() { 16 Mock mockPerson = mock(Person.class); 17 Person person = (Person)mockPerson.proxy(); 18 19 mockPerson.stubs().match(beanPropertyGetters).will(returnDefaultValue); 20 21 assertEquals("age", 0, person.age()); 22 assertEquals("name", "", person.name()); 23 assertEquals("children", 0, person.children().length); 24 assertNotNull("spouse", person.spouse()); 25 } 26 } 27 | Popular Tags |