Search in sources :

Example 11 with Response

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")));
}
Also used : Response(br.com.caelum.restfulie.Response) Test(org.junit.Test)

Example 12 with Response

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)));
}
Also used : Response(br.com.caelum.restfulie.Response) Test(org.junit.Test)

Example 13 with Response

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;
}
Also used : Response(br.com.caelum.restfulie.Response)

Aggregations

Response (br.com.caelum.restfulie.Response)13 Test (org.junit.Test)10 Item (br.com.caelum.example.model.Item)5 Basket (br.com.caelum.example.model.Basket)1 Payment (br.com.caelum.example.model.Payment)1 Order (br.com.caelum.restbucks.model.Order)1 Payment (br.com.caelum.restbucks.model.Payment)1 Resources (br.com.caelum.restfulie.Resources)1 SearchDescription (br.com.caelum.restfulie.opensearch.SearchDescription)1