use of br.com.caelum.restfulie.Response in project restfulie-java by caelum.
the class ClientTest method shouldTryAndPayForIt.
@Test
public void shouldTryAndPayForIt() {
Response response = search("20", 1);
List<Product> products = response.getResource();
Product product = products.get(0);
Order order = resource(products).getLink("order").follow().handling("application/xml").post(newOrder("Av. Princesa Isabel 350, Copacabana, Rio de Janeiro eh este")).getResource();
order = resource(order).getLink("self").follow().handling("application/xml").put(newOrder(product.getId())).getResource();
response = pay(order);
order = response.getResource();
order = waitPaymentSuccess(1, order);
assertThat(order.getState(), is(equalTo("preparing")));
}
use of br.com.caelum.restfulie.Response in project restfulie-java by caelum.
the class ClientTest method shouldBeAbleToSearchItems.
@Test
public void shouldBeAbleToSearchItems() {
Response response = search("20", 1);
List<Product> products = response.getResource();
assertThat(products.size(), is(equalTo(2)));
}
use of br.com.caelum.restfulie.Response in project restfulie-java by caelum.
the class AsynchronousRequest method call.
public Response call() {
Response response = null;
try {
response = getHttpMethod().execute(request, payload);
requestCallback.callback(response);
} catch (Exception e) {
requestCallback.onException(request, httpMethod, e);
}
return response;
}
Aggregations