Search in sources :

Example 1 with CookieGetBuilder

use of com.linkedin.restli.examples.greetings.client.CookieGetBuilder in project rest.li by linkedin.

the class TestCookieResource method testAddCookies.

/**
   * Test the add cookie functionality
   *
   * @throws RemoteInvocationException
   */
@Test
public void testAddCookies() throws RemoteInvocationException {
    CookieGetBuilder builderTmp = new CookieBuilders().get().id(1L);
    builderTmp.addCookie(new HttpCookie("C", "3"));
    builderTmp.addCookie(new HttpCookie("B", "2"));
    builderTmp.addCookie(new HttpCookie("A", "1"));
    GetRequest<Greeting> req = builderTmp.build();
    Response<Greeting> resp = REST_CLIENT.sendRequest(req).getResponse();
    List<HttpCookie> expectedCookies = Arrays.asList(new HttpCookie("3", "C"), new HttpCookie("2", "B"), new HttpCookie("1", "A"));
    Assert.assertEquals(resp.getCookies(), expectedCookies);
}
Also used : CookieBuilders(com.linkedin.restli.examples.greetings.client.CookieBuilders) CookieGetBuilder(com.linkedin.restli.examples.greetings.client.CookieGetBuilder) Greeting(com.linkedin.restli.examples.greetings.api.Greeting) HttpCookie(java.net.HttpCookie) Test(org.testng.annotations.Test)

Aggregations

Greeting (com.linkedin.restli.examples.greetings.api.Greeting)1 CookieBuilders (com.linkedin.restli.examples.greetings.client.CookieBuilders)1 CookieGetBuilder (com.linkedin.restli.examples.greetings.client.CookieGetBuilder)1 HttpCookie (java.net.HttpCookie)1 Test (org.testng.annotations.Test)1