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   
9   import static org.junit.Assert.*;
10  
11  public class AutowiredResourceTest {
12      private static final String PLUGIN_SERVICE_NAME = "Plugin service instance";
13  
14      private WebResource webResource;
15  
16      @Before
17      public void setUp() {
18          webResource = WebResourceFactory.authenticated();
19      }
20  
21      @Test
22      public void testGetAutowiredResource() {
23          final SomeService someService = webResource.path("autowired").get(SomeService.class);
24  
25          assertEquals(PLUGIN_SERVICE_NAME, someService.getName());
26      }
27  }