模拟java.sql.TimeStamp时的AssertionError

时间:2015-05-11 13:09:17

标签: java powermock

请在下面找到我的java代码。

Timestamp timestamp = PowerMock.createMock(Timestamp.class);
PowerMock.expectNew(Timestamp.class, new Class[] {long.class}, System.currentTimeMillis()).andReturn(timestamp).times(2);
PowerMock.replay(timestamp, Timestamp.class);
PowerMock.verify(timestamp, Timestamp.class);

然后我得到以下错误

  

java.lang.AssertionError:验证时出现预期失败:       java.sql.Timestamp(1431344562673):expected:1,actual:0 at org.powermock.api.easymock.internal.invocationcontrol.NewInvocationControlAssertionError.throwAssertionErrorForNewSubstitutionFailure(NewInvocationControlAssertionError.java:21)     在   org.powermock.api.easymock.PowerMock.verifyClass(PowerMock.java:2279)     在org.powermock.api.easymock.PowerMock.verify(PowerMock.java:1646)

为什么?

0 个答案:

没有答案