volume.setName("Test volume");
MovedVolumeDto movedRef = new MovedVolumeDto();
movedRef.setVolume(volume);
HttpResponse response = EasyMock.createMock(HttpResponse.class);
HttpResponseException exception = EasyMock.createMock(HttpResponseException.class);
Payload payload = Payloads.newByteSourcePayload(ByteSource.wrap(xmlParser.toXML(movedRef).getBytes()));
// Status code is called once
expect(response.getStatusCode()).andReturn(Status.MOVED_PERMANENTLY.getStatusCode());
// Get response gets called twice
expect(exception.getResponse()).andReturn(response);
expect(exception.getResponse()).andReturn(response);
// Get payload is called three times: one to deserialize it, and twice to
// release it
expect(response.getPayload()).andReturn(payload);
expect(response.getPayload()).andReturn(payload);
expect(response.getPayload()).andReturn(payload);
// Get cause is called to determine the root cause
expect(exception.getCause()).andReturn(null);
replay(response);
replay(exception);
function.create(exception);