当前位置: 首页>>代码示例>>Java>>正文


Java EasyMock.verify方法代码示例

本文整理汇总了Java中org.easymock.classextension.EasyMock.verify方法的典型用法代码示例。如果您正苦于以下问题:Java EasyMock.verify方法的具体用法?Java EasyMock.verify怎么用?Java EasyMock.verify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.easymock.classextension.EasyMock的用法示例。


在下文中一共展示了EasyMock.verify方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSetCharacterEncoding_allowsExceptionToPassBack

import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
@Test
public void testSetCharacterEncoding_allowsExceptionToPassBack()
    throws UnsupportedEncodingException {
  final UnsupportedEncodingException expected
      = new UnsupportedEncodingException();
  mockSubset.setCharacterEncoding(EasyMock.eq(VALUE));
  EasyMock.expectLastCall().andThrow(expected);
  EasyMock.replay(mockSubset);
  try {
    adapter.setCharacterEncoding(VALUE);
    fail("Should pass exception through");
  } catch (UnsupportedEncodingException actual) {
    assertThat(actual, sameInstance(expected));
  }
  EasyMock.verify(mockSubset);
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:17,代码来源:HttpServletRequestAdapterTest.java

示例2: testRun

import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
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);
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:17,代码来源:WorkerThreadTest.java

示例3: testLaziness

import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
public void testLaziness() throws InvalidProtocolBufferException {
  LazyInnerMessageLite inner = LazyInnerMessageLite.newBuilder()
      .setNum(2)
      .build();
  LazyMessageLite outer = LazyMessageLite.newBuilder()
      .setNum(1)
      .setInner(inner)
      .setOneofInner(inner)
      .build();
  ByteString bytes = outer.toByteString();


  // The parser for inner / oneofInner message shouldn't be used if
  // getInner / getOneofInner is not called.
  LazyInnerMessageLite.PARSER = EasyMock.createStrictMock(Parser.class);

  EasyMock.replay(LazyInnerMessageLite.PARSER);

  LazyMessageLite deserialized = LazyMessageLite.parseFrom(bytes);
  assertEquals(1, deserialized.getNum());
  assertEquals(421,  deserialized.getNumWithDefault());

  EasyMock.verify(LazyInnerMessageLite.PARSER);
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:25,代码来源:LazyMessageLiteTest.java

示例4: testRunThrowsNullPointerExceptionIfQueueReturnsNull

import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
public void testRunThrowsNullPointerExceptionIfQueueReturnsNull()
    throws Exception {
  RunnableQueue q = EasyMock.createMock(RunnableQueue.class);
  EasyMock.expect(q.remove()).andReturn(null);
  EasyMock.replay(q);
  QueueExtractor extractor = new QueueExtractor(q);
  try {
    extractor.run();
    fail("NullPointerException expected");
  } catch (NullPointerException e) { /* expected */ }
  EasyMock.verify(q);
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:13,代码来源:QueueExtractorTest.java

示例5: testHandleRequest

import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
@Test
public void testHandleRequest() throws Exception {
  FilterChain chain = EasyMock.createMock(FilterChain.class);
  HttpRequest request = EasyMock.createMock(HttpRequest.class);
  HttpResponse response = EasyMock.createMock(HttpResponse.class);
  HttpRequestHandlerAdapter adapter = new HttpRequestHandlerAdapter(chain);
  chain.doFilter(EasyMock.isA(HttpServletRequestAdapter.class),
      EasyMock.isA(HttpServletResponseAdapter.class));
  EasyMock.expectLastCall();
  EasyMock.expect(request.getConnectionInformation()).andReturn(null);
  EasyMock.replay(chain, request, response);
  adapter.handleRequest(request, response);
  EasyMock.verify(chain, request, response);
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:15,代码来源:HttpRequestHandlerAdapterTest.java

示例6: setUp

import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
@Before
public void setUp() {
  mockSubset = EasyMock.createStrictMock(HttpRequest.class);
  EasyMock.expect(mockSubset.getConnectionInformation()).andReturn(null);
  EasyMock.replay(mockSubset);
  adapter = new HttpServletRequestAdapter(mockSubset);
  EasyMock.verify(mockSubset);
  // We have to do a replay and reset here because HttpServletRequestAdapter
  // calls getConnectionInformation() on the HttpRequest in its constructor.
  EasyMock.reset(mockSubset);
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:12,代码来源:HttpServletRequestAdapterTest.java

示例7: testGetHeader

import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
@Test
public void testGetHeader() {
  EasyMock.expect(mockSubset.getHeader(NAME)).andReturn(VALUE);
  EasyMock.replay(mockSubset);
  assertThat(adapter.getHeader(NAME), is(VALUE));
  EasyMock.verify(mockSubset);
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:8,代码来源:HttpServletRequestAdapterTest.java

示例8: testGetHeaders

import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
@Test
public void testGetHeaders() {
  final Enumeration<String> mockEnumeration = createMockEnumeration();
  EasyMock.expect(mockSubset.getHeaders(NAME)).andReturn(mockEnumeration);
  EasyMock.replay(mockSubset, mockEnumeration);
  assertThat(adapter.getHeaders(NAME), sameInstance(mockEnumeration));
  EasyMock.verify(mockSubset, mockEnumeration);
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:9,代码来源:HttpServletRequestAdapterTest.java

示例9: testGetHeaderNames

import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
@Test
public void testGetHeaderNames() {
  final Enumeration<String> mockEnumeration = createMockEnumeration();
  EasyMock.expect(mockSubset.getHeaderNames()).andReturn(mockEnumeration);
  EasyMock.replay(mockSubset, mockEnumeration);
  assertThat(adapter.getHeaderNames(), sameInstance(mockEnumeration));
  EasyMock.verify(mockSubset, mockEnumeration);
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:9,代码来源:HttpServletRequestAdapterTest.java

示例10: testGetMethod

import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
@Test
public void testGetMethod() {
  EasyMock.expect(mockSubset.getMethod()).andReturn(NAME);
  EasyMock.replay(mockSubset);
  assertThat(adapter.getMethod(), is(NAME));
  EasyMock.verify(mockSubset);
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:8,代码来源:HttpServletRequestAdapterTest.java

示例11: testGetPathTranslated

import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
@Test
public void testGetPathTranslated() {
  EasyMock.expect(mockSubset.getPathTranslated()).andReturn(VALUE);
  EasyMock.replay(mockSubset);
  assertThat(adapter.getPathTranslated(), is(VALUE));
  EasyMock.verify(mockSubset);
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:8,代码来源:HttpServletRequestAdapterTest.java

示例12: testGetLocale

import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
@Test
public void testGetLocale() {
  final Locale locale = Locale.ITALIAN;
  EasyMock.expect(mockSubset.getLocale()).andReturn(locale);
  EasyMock.replay(mockSubset);
  assertThat(adapter.getLocale(), is(locale));
  EasyMock.verify(mockSubset);
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:9,代码来源:HttpServletRequestAdapterTest.java

示例13: testGetRequestURI

import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
@Test
public void testGetRequestURI() {
  EasyMock.expect(mockSubset.getRequestURI()).andReturn(VALUE);
  EasyMock.replay(mockSubset);
  assertThat(adapter.getRequestURI(), is(VALUE));
  EasyMock.verify(mockSubset);
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:8,代码来源:HttpServletRequestAdapterTest.java

示例14: testGetRequestURL

import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
@Test
public void testGetRequestURL() {
  final StringBuffer requestUrl = new StringBuffer(VALUE);
  EasyMock.expect(mockSubset.getRequestURL()).andReturn(requestUrl);
  EasyMock.replay(mockSubset);
  assertThat(adapter.getRequestURL(), is(requestUrl));
  EasyMock.verify(mockSubset);
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:9,代码来源:HttpServletRequestAdapterTest.java

示例15: testSetCharacterEncoding_passesEncodingToSubset

import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
@Test
public void testSetCharacterEncoding_passesEncodingToSubset()
    throws UnsupportedEncodingException {
  mockSubset.setCharacterEncoding(EasyMock.eq(VALUE));
  EasyMock.expectLastCall().once();
  EasyMock.replay(mockSubset);
  adapter.setCharacterEncoding(VALUE);
  EasyMock.verify(mockSubset);
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:10,代码来源:HttpServletRequestAdapterTest.java


注:本文中的org.easymock.classextension.EasyMock.verify方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。