verifyAll();
}
@Test
public void niceToStrict() {
final IMethods mock1 = createNiceMock(IMethods.class);
final IMethods mock2 = createNiceMock(IMethods.class);
expect(mock1.oneArg(false)).andReturn("foo");
expect(mock2.oneArg(false)).andReturn("foo");
replayAll();
assertNull(mock1.oneArg(true));
assertNull(mock2.oneArg(true));
resetAllToStrict();
expect(mock1.oneArg(false)).andReturn("foo");
expect(mock1.oneArg(true)).andReturn("foo");
expect(mock2.oneArg(false)).andReturn("foo");
expect(mock2.oneArg(true)).andReturn("foo");
replayAll();
try {
mock1.oneArg(true);
fail("Should be strict");
} catch (final AssertionError e) {
}
try {
mock2.oneArg(true);
fail("Should be strict");
} catch (final AssertionError e) {
}
assertEquals("foo", mock1.oneArg(false));
assertEquals("foo", mock1.oneArg(true));
assertEquals("foo", mock2.oneArg(false));
assertEquals("foo", mock2.oneArg(true));
verifyAll();
}