本文整理匯總了Java中org.powermock.api.easymock.PowerMock.resetAll方法的典型用法代碼示例。如果您正苦於以下問題:Java PowerMock.resetAll方法的具體用法?Java PowerMock.resetAll怎麽用?Java PowerMock.resetAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.powermock.api.easymock.PowerMock
的用法示例。
在下文中一共展示了PowerMock.resetAll方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testClose
import org.powermock.api.easymock.PowerMock; //導入方法依賴的package包/類
@Test
public void testClose() throws Exception {
long timeoutMs = 1000;
// Normal termination, where termination times out.
executor.shutdown();
PowerMock.expectLastCall();
EasyMock.expect(executor.awaitTermination(eq(timeoutMs), eq(TimeUnit.MILLISECONDS)))
.andReturn(false);
mockLog.error(EasyMock.anyString());
PowerMock.expectLastCall();
PowerMock.replayAll();
committer.close(timeoutMs);
PowerMock.verifyAll();
PowerMock.resetAll();
// Termination interrupted
executor.shutdown();
PowerMock.expectLastCall();
EasyMock.expect(executor.awaitTermination(eq(timeoutMs), eq(TimeUnit.MILLISECONDS)))
.andThrow(new InterruptedException());
PowerMock.replayAll();
committer.close(timeoutMs);
PowerMock.verifyAll();
}
示例2: testRemove
import org.powermock.api.easymock.PowerMock; //導入方法依賴的package包/類
@Test
public void testRemove() throws Exception {
ConnectorTaskId taskId = PowerMock.createMock(ConnectorTaskId.class);
ScheduledFuture task = PowerMock.createMock(ScheduledFuture.class);
// Try to remove a non-existing task
EasyMock.expect(committers.remove(taskId)).andReturn(null);
PowerMock.replayAll();
committer.remove(taskId);
PowerMock.verifyAll();
PowerMock.resetAll();
// Try to remove an existing task
EasyMock.expect(committers.remove(taskId)).andReturn(task);
EasyMock.expect(task.cancel(eq(false))).andReturn(false);
EasyMock.expect(task.isDone()).andReturn(false);
EasyMock.expect(task.get()).andReturn(null);
PowerMock.replayAll();
committer.remove(taskId);
PowerMock.verifyAll();
PowerMock.resetAll();
// Try to remove a cancelled task
EasyMock.expect(committers.remove(taskId)).andReturn(task);
EasyMock.expect(task.cancel(eq(false))).andReturn(false);
EasyMock.expect(task.isDone()).andReturn(false);
EasyMock.expect(task.get()).andThrow(new CancellationException());
mockLog.trace(EasyMock.anyString(), EasyMock.<Object>anyObject());
PowerMock.expectLastCall();
PowerMock.replayAll();
committer.remove(taskId);
PowerMock.verifyAll();
PowerMock.resetAll();
// Try to remove an interrupted task
EasyMock.expect(committers.remove(taskId)).andReturn(task);
EasyMock.expect(task.cancel(eq(false))).andReturn(false);
EasyMock.expect(task.isDone()).andReturn(false);
EasyMock.expect(task.get()).andThrow(new InterruptedException());
PowerMock.replayAll();
try {
committer.remove(taskId);
fail("Expected ConnectException to be raised");
} catch (ConnectException e) {
//ignore
}
PowerMock.verifyAll();
}
示例3: tearDown
import org.powermock.api.easymock.PowerMock; //導入方法依賴的package包/類
@After
public void tearDown() throws Exception {
helper.tearDown();
PowerMock.resetAll();
}