View Javadoc

1   package it.com.atlassian.rest.autowire;
2   
3   import com.atlassian.plugins.rest.autowiring.SomeService;
4   import com.atlassian.rest.jersey.client.WebResourceFactory;
5   import com.sun.jersey.api.client.WebResource;
6   import org.junit.Before;
7   import org.junit.Test;
8   import static org.junit.Assert.*;
9   
10  public class AutowiredResourceTest
11  {
12      private static final String PLUGIN_SERVICE_NAME = "Plugin service instance";
13  
14      private WebResource webResource;
15  
16      @Before
17      public void setUp()
18      {
19          webResource = WebResourceFactory.authenticated();
20      }
21  
22      @Test
23      public void testGetAutowiredResource()
24      {
25          final SomeService someService = webResource.path("autowired").get(SomeService.class);
26  
27          assertEquals(PLUGIN_SERVICE_NAME, someService.getName());
28      }
29  }