View Javadoc
1   ////////////////////////////////////////////////////////////////////////////////
2   // checkstyle: Checks Java source code for adherence to a set of rules.
3   // Copyright (C) 2001-2017 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.google.checkstyle.test.chapter4formatting.rule488numericliterals;
21  
22  import org.junit.Test;
23  
24  import com.google.checkstyle.test.base.AbstractModuleTestSupport;
25  import com.puppycrawl.tools.checkstyle.api.Configuration;
26  
27  public class UpperEllTest extends AbstractModuleTestSupport {
28  
29      @Override
30      protected String getPackageLocation() {
31          return "com/google/checkstyle/test/chapter4formatting/rule488numericliterals";
32      }
33  
34      @Test
35      public void testUpperEll() throws Exception {
36  
37          final String[] expected = {
38              "6:36: Should use uppercase 'L'.",
39              "12:27: Should use uppercase 'L'.",
40              "14:32: Should use uppercase 'L'.",
41              "17:19: Should use uppercase 'L'.",
42              "21:29: Should use uppercase 'L'.",
43              "22:22: Should use uppercase 'L'.",
44              "25:15: Should use uppercase 'L'.",
45              "34:47: Should use uppercase 'L'.",
46              "40:31: Should use uppercase 'L'.",
47              "42:36: Should use uppercase 'L'.",
48              "45:23: Should use uppercase 'L'.",
49              "50:33: Should use uppercase 'L'.",
50              "51:26: Should use uppercase 'L'.",
51              "56:23: Should use uppercase 'L'.",
52              "65:48: Should use uppercase 'L'.",
53              "71:39: Should use uppercase 'L'.",
54              "73:44: Should use uppercase 'L'.",
55              "76:31: Should use uppercase 'L'.",
56              "80:41: Should use uppercase 'L'.",
57              "81:34: Should use uppercase 'L'.",
58              "84:27: Should use uppercase 'L'.",
59              "97:46: Should use uppercase 'L'.",
60              "99:29: Should use uppercase 'L'.",
61              "100:22: Should use uppercase 'L'.",
62          };
63  
64          final Configuration checkConfig = getModuleConfig("UpperEll");
65          final String filePath = getPath("InputUpperEll.java");
66  
67          final Integer[] warnList = getLinesWithWarn(filePath);
68          verify(checkConfig, filePath, expected, warnList);
69      }
70  }