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      @Test
13      public void testGet1_1Resource() {
14          WebResource webResource10 = WebResourceFactory.authenticated(WebResourceFactory.REST_VERSION);
15          WebResource webResource11 = WebResourceFactory.authenticated(WebResourceFactory.REST_VERSION + ".1");
16  
17          try {
18              webResource10.path("version1_1Resource").get(String.class);
19              fail("Should have failed due to missing resource");
20          } catch (UniformInterfaceException ex) {
21              assertEquals(404, ex.getResponse().getStatus());
22          }
23  
24          assertEquals("Version 1.1 Hello World", webResource11.path("version1_1Resource").get(String.class));
25      }
26  }