Im a newcomer for this so please dont slam me lower.
I am attempting to mock a Postmethod to ensure that I'm able to set the status it returns. For example I wish to set my PostMethod to 200.
The reason behind carrying this out is I'm attempting to mock a pc without a web connection
Thanks ahead of time
What mocking library are you currently using? The syntax will be different.
In Mockito, for instance, you may perform the following:
final PostMethod mockPostMethod = Mockito.mock(PostMethod.class); when(mockPostMethod.execute(Mockito.any(HttpState.class), Mockito.any(HttpConnection.class))).thenReturn(200);
Not to mention you could utilize a static import from the Mockito class to prevent the additional qualified references.