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; }
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; }