Update of /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic
In directory usw-pr-cvs1:/tmp/cvs-serv31713/src/core/test/mockobjects/dynamic
Added Files:
MockTrainerTest.java
Log Message:
started dynamic.Trainer
--- NEW FILE: MockTrainerTest.java ---
package test.mockobjects.dynamic;
import com.mockobjects.dynamic.Mock;
import com.mockobjects.util.TestCaseMo;
/*
* Date: 25-Oct-2002
*/
public class MockTrainerTest
extends TestCaseMo
{
private Mock exampleMock = new Mock("example");
private Example trainer = (Example)exampleMock.getTrainer(Example.class);
private Example example = (Example)exampleMock.createInterface(Example.class);
public MockTrainerTest(String s) {
super(s);
}
public void testDontCallEmptyMethod() {
trainer.anEmptyMethod();
assertFails("should fail when did not call trained method",
new Runnable() {
public void run() { exampleMock.verify(); }
});
}
public void testCallEmptyMethod() {
trainer.anEmptyMethod();
example.anEmptyMethod();
exampleMock.verify();
}
public void testCallVoidMethodWithArg() {
trainer.aVoidWithArgMethod("value");
example.aVoidWithArgMethod("value");
exampleMock.verify();
}
public void testCallVoidMethodWithWrongArg() {
trainer.aVoidWithArgMethod("value");
assertFails("should fail when input parameter different",
new Runnable() {
public void run() { example.aVoidWithArgMethod("another"); }
});
}
static public interface Example {
void anEmptyMethod();
void aVoidWithArgMethod(Object anObject);
}
}
|