}
@Test
public void testChainBuildRestRequestFromRequestBuilder()
{
final Request req = new RestRequestBuilder(URI.create("test"))
.setEntity(new byte[] {1,2,3,4})
.setHeader("k1", "v1")
.setMethod(RestMethod.PUT)
.build()
.requestBuilder()
.setEntity(new byte[] {5,6,7,8})
.setURI(URI.create("anotherURI"))
.build();
Assert.assertEquals(new byte[] {5,6,7,8}, req.getEntity().copyBytes());
Assert.assertEquals(URI.create("anotherURI"), req.getURI());
Assert.assertTrue(req instanceof RestRequest);
final RestRequest restReq = (RestRequest)req;
Assert.assertEquals("v1", restReq.getHeader("k1"));
Assert.assertEquals(RestMethod.PUT, restReq.getMethod());