1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package com.google.checkstyle.test.chapter5naming.rule521packagenames;
21
22 import java.io.File;
23 import java.io.IOException;
24
25 import org.junit.jupiter.api.Test;
26
27 import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport;
28
29 public class PackageNamesTest extends AbstractGoogleModuleTestSupport {
30
31 @Override
32 protected String getPackageLocation() {
33 return "com/google/checkstyle/test/chapter5naming";
34 }
35
36 private String getPath(String packageName, String fileName) throws IOException {
37 return getPath("rule521" + packageName + File.separator + fileName);
38 }
39
40 @Test
41 public void testGoodPackageName() throws Exception {
42 verifyWithWholeConfig(getPath("packagenames", "InputPackageNameGood.java"));
43 }
44
45 @Test
46 public void testBadPackageName() throws Exception {
47 verifyWithWholeConfig(getPath("packageNamesCamelCase", "InputPackageNameBad.java"));
48 }
49
50 @Test
51 public void testBadPackageName2() throws Exception {
52 verifyWithWholeConfig(getPath("_packagenames", "InputBadPackageName2.java"));
53 }
54
55 @Test
56 public void testBadPackageName3() throws Exception {
57 verifyWithWholeConfig(getPath("$packagenames", "InputPackageBadName3.java"));
58 }
59
60 }