WorkerThreadTest.java 文件源码

java
阅读 14 收藏 0 点赞 0 评论 0

项目:opengse 作者:
public void testRun() throws Exception {
  RunnableQueue q = EasyMock.createMock(RunnableQueue.class);
  Runnable task1 = EasyMock.createMock(Runnable.class);
  Runnable task2 = EasyMock.createMock(Runnable.class);
  EasyMock.expect(q.remove()).andReturn(task1);
  task1.run();
  EasyMock.expectLastCall();
  EasyMock.expect(q.remove()).andReturn(task2);
  task2.run();
  EasyMock.expectLastCall();
  EasyMock.expect(q.remove()).andThrow(new InterruptedException());
  EasyMock.replay(q, task1, task2);
  WorkerThread worker = new WorkerThread(q, "test thread");
  worker.run();
  EasyMock.verify(q, task1, task2);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号