1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package com.puppycrawl.tools.checkstyle.checks.annotation;
21
22 import static com.puppycrawl.tools.checkstyle.checks.annotation.MissingOverrideCheck.MSG_KEY_ANNOTATION_MISSING_OVERRIDE;
23 import static com.puppycrawl.tools.checkstyle.checks.annotation.MissingOverrideCheck.MSG_KEY_TAG_NOT_VALID_ON;
24
25 import org.junit.jupiter.api.Test;
26
27 import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport;
28
29 public class MissingOverrideCheckExamplesTest extends AbstractExamplesModuleTestSupport {
30
31 @Override
32 public String getPackageLocation() {
33 return "com/puppycrawl/tools/checkstyle/checks/annotation/missingoverride";
34 }
35
36 @Test
37 public void testExample1() throws Exception {
38 final String[] expected = {
39 "20:3: " + getCheckMessage(MSG_KEY_ANNOTATION_MISSING_OVERRIDE, "test"),
40 "33:3: " + getCheckMessage(MSG_KEY_ANNOTATION_MISSING_OVERRIDE, "test2"),
41 "37:3: " + getCheckMessage(MSG_KEY_TAG_NOT_VALID_ON, "{@inheritDoc}"),
42 "41:3: " + getCheckMessage(MSG_KEY_TAG_NOT_VALID_ON, "{@inheritDoc}"),
43 "46:3: " + getCheckMessage(MSG_KEY_ANNOTATION_MISSING_OVERRIDE, "equals"),
44 "55:3: " + getCheckMessage(MSG_KEY_ANNOTATION_MISSING_OVERRIDE, "test"),
45 };
46 verifyWithInlineConfigParser(getPath("Example1.java"), expected);
47 }
48
49 @Test
50 public void testExample2() throws Exception {
51 final String[] expected = {
52 "28:3: " + getCheckMessage(MSG_KEY_TAG_NOT_VALID_ON, "{@inheritDoc}"),
53 "32:3: " + getCheckMessage(MSG_KEY_TAG_NOT_VALID_ON, "{@inheritDoc}"),
54 };
55
56 verifyWithInlineConfigParser(getPath("Example2.java"), expected);
57 }
58
59 }