Пример #1
0
  public static Request mockWith(EntityWriter mockWriter) {
    Request mockRequest = mock(Request.class);
    MethodConfig mockMethodConfig = mock(MethodConfig.class);

    when(mockRequest.getMethodConfig()).thenReturn(mockMethodConfig);
    when(mockMethodConfig.getEntityWriter()).thenReturn(mockWriter);

    return mockRequest;
  }
Пример #2
0
  public static Request mockWith(Method method) {
    Request mockRequest = mock(Request.class);
    MethodConfig mockMethodConfig = mock(MethodConfig.class);

    when(mockRequest.getMethodConfig()).thenReturn(mockMethodConfig);
    when(mockMethodConfig.getMethod()).thenReturn(method);

    return mockRequest;
  }