1 package com.puppycrawl.tools.checkstyle.checks.whitespace; 2 3 import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; 4 import com.puppycrawl.tools.checkstyle.DefaultConfiguration; 5 6 public class WhitespaceAfterCheckTest 7 extends BaseCheckTestCase 8 { 9 private DefaultConfiguration mCheckConfig; 10 11 public void setUp() 12 { 13 mCheckConfig = createCheckConfig(WhitespaceAfterCheck.class); 14 } 15 16 public void testDefault() throws Exception 17 { 18 final String [] expected = { 19 "42:40: ',' is not followed by whitespace.", 20 "71:30: ',' is not followed by whitespace.", 21 }; 22 verify(mCheckConfig, getPath("InputSimple.java"), expected); 23 } 24 25 public void testCast() throws Exception 26 { 27 final String [] expected = { 28 "88:21: 'cast' is not followed by whitespace.", 29 }; 30 verify(mCheckConfig, getPath("InputWhitespace.java"), expected); 31 } 32 33 public void testSemi() throws Exception 34 { 35 final String [] expected = { 36 "58:23: ';' is not followed by whitespace.", 37 "58:29: ';' is not followed by whitespace.", 38 "107:19: ';' is not followed by whitespace.", 39 }; 40 verify(mCheckConfig, getPath("InputBraces.java"), expected); 41 } 42 43 public void testEmptyForIterator() throws Exception 44 { 45 final String [] expected = { 46 "14:31: ';' is not followed by whitespace.", 47 "17:31: ';' is not followed by whitespace.", 48 }; 49 verify(mCheckConfig, getPath("InputForWhitespace.java"), expected); 50 } 51 52 public void testTypeArgumentAndParameterCommas() throws Exception 53 { 54 final String [] expected = { 55 "11:21: ',' is not followed by whitespace.", 56 "11:23: ',' is not followed by whitespace.", 57 "11:41: ',' is not followed by whitespace.", 58 }; 59 verify(mCheckConfig, getPath("InputGenerics.java"), expected); 60 } 61 62 public void test1322879() throws Exception 63 { 64 final String [] expected = { 65 }; 66 verify(mCheckConfig, getPath("whitespace/InputWhitespaceAround.java"), 67 expected); 68 } 69 } 70 | Popular Tags |