KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > puppycrawl > tools > checkstyle > checks > coding > IllegalTokenCheckTest


1 package com.puppycrawl.tools.checkstyle.checks.coding;
2
3 import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
4 import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
5
6 public class IllegalTokenCheckTest
7     extends BaseCheckTestCase
8 {
9     public void testDefault()
10         throws Exception JavaDoc
11     {
12         final DefaultConfiguration checkConfig =
13             createCheckConfig(IllegalTokenCheck.class);
14         final String JavaDoc[] expected = {
15             "11:9: Using 'switch' is not allowed.",
16             "14:18: Using '--' is not allowed.",
17             "15:18: Using '++' is not allowed.",
18         };
19         verify(checkConfig, getPath("InputIllegalTokens.java"), expected);
20     }
21     
22     public void testNative()
23          throws Exception JavaDoc
24      {
25          final DefaultConfiguration checkConfig =
26              createCheckConfig(IllegalTokenCheck.class);
27          checkConfig.addAttribute("tokens", "LITERAL_NATIVE");
28          final String JavaDoc[] expected = {
29              "20:12: Using 'native' is not allowed.",
30          };
31          verify(checkConfig, getPath("InputIllegalTokens.java"), expected);
32      }
33     
34 }
35
36
Popular Tags