| Home >> All >> com >> puppycrawl >> tools >> checkstyle >> [ checks Javadoc ] |
Source code: com/puppycrawl/tools/checkstyle/checks/FileSetCheckLifecycleTest.java
1 package com.puppycrawl.tools.checkstyle.checks; 2 3 import java.io.File; 4 5 import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; 6 import com.puppycrawl.tools.checkstyle.DefaultConfiguration; 7 import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck; 8 import com.puppycrawl.tools.checkstyle.api.Configuration; 9 10 public class FileSetCheckLifecycleTest 11 extends BaseCheckTestCase 12 { 13 protected DefaultConfiguration createCheckerConfig(Configuration aCheckConfig) 14 { 15 final DefaultConfiguration dc = new DefaultConfiguration("root"); 16 dc.addChild(aCheckConfig); 17 return dc; 18 } 19 20 public static class TestFileSetCheck extends AbstractFileSetCheck 21 { 22 private static boolean destroyed = false; 23 24 public void destroy() 25 { 26 destroyed = true; 27 } 28 29 public static boolean isDestroyed() 30 { 31 return destroyed; 32 } 33 34 public void process(File[] aFiles) 35 { 36 } 37 } 38 39 public void testTranslation() 40 throws Exception 41 { 42 final Configuration checkConfig = 43 createCheckConfig(TestFileSetCheck.class); 44 final String[] expected = { 45 }; 46 verify(checkConfig, getPath("InputScopeAnonInner.java"), expected); 47 48 assertTrue("destroy() not called by Checker", TestFileSetCheck.isDestroyed()); 49 } 50 51 }