View Javadoc
1   ///////////////////////////////////////////////////////////////////////////////////////////////
2   // checkstyle: Checks Java source code and other text files for adherence to a set of rules.
3   // Copyright (C) 2001-2024 the original author or authors.
4   //
5   // This library is free software; you can redistribute it and/or
6   // modify it under the terms of the GNU Lesser General Public
7   // License as published by the Free Software Foundation; either
8   // version 2.1 of the License, or (at your option) any later version.
9   //
10  // This library is distributed in the hope that it will be useful,
11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  // Lesser General Public License for more details.
14  //
15  // You should have received a copy of the GNU Lesser General Public
16  // License along with this library; if not, write to the Free Software
17  // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  ///////////////////////////////////////////////////////////////////////////////////////////////
19  
20  package com.puppycrawl.tools.checkstyle.grammar.java8;
21  
22  import org.junit.jupiter.api.Test;
23  
24  import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
25  import com.puppycrawl.tools.checkstyle.utils.CommonUtil;
26  
27  public class AnnotationTest extends AbstractModuleTestSupport {
28  
29      @Override
30      protected String getPackageLocation() {
31          return "com/puppycrawl/tools/checkstyle/grammar/java8";
32      }
33  
34      @Test
35      public void testSimpleTypeAnnotation()
36              throws Exception {
37          final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
38          verifyWithInlineConfigParser(getPath("InputAnnotations1.java"), expected);
39      }
40  
41      @Test
42      public void testAnnotationOnClass()
43              throws Exception {
44          final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
45          verifyWithInlineConfigParser(getPath("InputAnnotations2.java"), expected);
46      }
47  
48      @Test
49      public void testClassCastTypeAnnotation()
50              throws Exception {
51          final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
52          verifyWithInlineConfigParser(getPath("InputAnnotations3.java"), expected);
53      }
54  
55      @Test
56      public void testMethodParametersTypeAnnotation()
57              throws Exception {
58          final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
59          verifyWithInlineConfigParser(getPath("InputAnnotations4.java"), expected);
60      }
61  
62      @Test
63      public void testAnnotationInThrows()
64              throws Exception {
65          final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
66          verifyWithInlineConfigParser(getPath("InputAnnotations5.java"), expected);
67      }
68  
69      @Test
70      public void testAnnotationInGeneric()
71              throws Exception {
72          final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
73          verifyWithInlineConfigParser(getPath("InputAnnotations6.java"), expected);
74      }
75  
76      @Test
77      public void testAnnotationOnConstructorCall()
78              throws Exception {
79          final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
80          verifyWithInlineConfigParser(getPath("InputAnnotations7.java"), expected);
81      }
82  
83      @Test
84      public void testAnnotationNestedCall()
85              throws Exception {
86          final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
87          verifyWithInlineConfigParser(getPath("InputAnnotations8.java"), expected);
88      }
89  
90      @Test
91      public void testAnnotationOnWildcards()
92              throws Exception {
93          final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
94          verifyWithInlineConfigParser(getPath("InputAnnotations9.java"), expected);
95      }
96  
97      @Test
98      public void testAnnotationInCatchParameters()
99              throws Exception {
100         final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
101         verifyWithInlineConfigParser(getPath("InputAnnotations10.java"), expected);
102     }
103 
104     @Test
105     public void testAnnotationInTypeParameters()
106             throws Exception {
107         final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
108         verifyWithInlineConfigParser(getPath("InputAnnotations11.java"), expected);
109     }
110 
111     @Test
112     public void testAnnotationOnVarargs()
113             throws Exception {
114         final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
115         verifyWithInlineConfigParser(getPath("InputAnnotations12.java"), expected);
116     }
117 
118 }