Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Mockery mocker = new Mockery(){{
- setImposteriser(ClassImposteriser.INSTANCE);
- }};
- // Setup http mocks
- final DefaultHttpClient httpClient = mocker.mock(DefaultHttpClient.class);
- final HttpResponse httpResponse = mocker.mock(HttpResponse.class);
- final HttpEntity httpEntity = mocker.mock(HttpEntity.class);
- try {
- mocker.checking(new Expectations() {{
- oneOf (httpClient).execute(with(any(HttpUriRequest.class)));
- will(returnValue(httpResponse));
- oneOf (httpResponse).getEntity();
- will(returnValue(httpEntity));
- oneOf (httpEntity).getContent();
- will(returnValue(new ByteArrayInputStream("Boo".getBytes("UTF-8"))));
- }});
- }catch(Exception e){
- e.printStackTrace();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement