View Javadoc

1   package com.atlassian.plugins.rest.common.feature.jersey;
2   
3   import org.junit.Test;
4   import org.mockito.InjectMocks;
5   
6   import static org.hamcrest.Matchers.empty;
7   import static org.hamcrest.Matchers.hasSize;
8   import static org.junit.Assert.assertThat;
9   
10  public class DarkFeatureResourceFilterFactoryTest extends AbstractDarkFeatureResourceFilterTest {
11      @InjectMocks
12      private DarkFeatureResourceFilterFactory classUnderTest;
13  
14      @Test
15      public void testCreateWithNoAnnotations() {
16          setResourceAnnotated(false);
17          setMethodAnnotated(false);
18  
19          assertThat(classUnderTest.create(abstractMethod), empty());
20      }
21  
22      @Test
23      public void testCreateWithResourceAnnotations() {
24          setResourceAnnotated(true);
25          setMethodAnnotated(false);
26  
27          assertThat(classUnderTest.create(abstractMethod), hasSize(1));
28      }
29  
30      @Test
31      public void testCreateWithMethodAnnotations() {
32          setResourceAnnotated(false);
33          setMethodAnnotated(true);
34  
35          assertThat(classUnderTest.create(abstractMethod), hasSize(1));
36      }
37  
38      @Test
39      public void testCreateWithResourceAndMethodAnnotations() {
40          setResourceAnnotated(true);
41          setMethodAnnotated(true);
42  
43          assertThat(classUnderTest.create(abstractMethod), hasSize(1));
44      }
45  }