View Javadoc

1   package it.com.atlassian.rest.v1_1;
2   
3   import com.atlassian.rest.jersey.client.WebResourceFactory;
4   import com.sun.jersey.api.client.UniformInterfaceException;
5   import com.sun.jersey.api.client.WebResource;
6   import org.junit.Test;
7   
8   import static junit.framework.Assert.fail;
9   import static org.junit.Assert.assertEquals;
10  
11  public class Version1_1ResourceTest
12  {
13      @Test
14      public void testGet1_1Resource()
15      {
16          WebResource webResource10 = WebResourceFactory.authenticated(WebResourceFactory.REST_VERSION);
17          WebResource webResource11 = WebResourceFactory.authenticated(WebResourceFactory.REST_VERSION + ".1");
18  
19          try
20          {
21              webResource10.path("version1_1Resource").get(String.class);
22              fail("Should have failed due to missing resource");
23          }
24          catch (UniformInterfaceException ex)
25          {
26              assertEquals(404, ex.getResponse().getStatus());
27          }
28  
29          assertEquals("Version 1.1 Hello World", webResource11.path("version1_1Resource").get(String.class));
30      }
31  }