@Test void enforce_CheckList_registration() { List<File> files = (List<File>) FileUtils.listFiles(new File("src/main/java/org/sonar/java/checks/"), new String[] {"java"}, false); List<Class<?>> checks = CheckList.getChecks(); for (File file : files) { String name = file.getName(); if (name.endsWith("Check.java")) { String className = name.substring(0, name.length() - 5); try { Class<?> aClass = Class.forName("org.sonar.java.checks." + className); assertThat(checks).as(className + " is not declared in CheckList").contains(aClass); } catch (ClassNotFoundException e) { throw new IllegalStateException(e); } } } }
public static List<Class<?>> getChecks() { return ImmutableList.<Class<?>>builder() .addAll(getJavaChecks()) .addAll(getJavaTestChecks()) .addAll(getXmlChecks()) .build(); }
CheckList { public static List<Class<?>> getChecks() { return ImmutableList.<Class<?>>builder() .addAll(getJavaChecks()) .addAll(getJavaTestChecks()) .addAll(getXmlChecks()) .build(); } }
CheckList { public static List<Class<?>> getChecks() { return ImmutableList.<Class<?>>builder() .addAll(getJavaChecks()) .addAll(getJavaTestChecks()) .addAll(getXmlChecks()) .build(); } private  CheckList(); }
CheckList { public static List<Class<?>> getChecks() { return ImmutableList.<Class<?>>builder() .addAll(getJavaChecks()) .addAll(getJavaTestChecks()) .addAll(getXmlChecks()) .build(); } private  CheckList(); static List<Class<?>> getChecks(); static List<Class<? extends JavaCheck>> getJavaChecks(); static List<Class<? extends DebugCheck>> getDebugChecks(); static List<Class<? extends JavaCheck>> getJavaTestChecks(); static List<Class<? extends SonarXmlCheck>> getXmlChecks(); }
CheckList { public static List<Class<?>> getChecks() { return ImmutableList.<Class<?>>builder() .addAll(getJavaChecks()) .addAll(getJavaTestChecks()) .addAll(getXmlChecks()) .build(); } private  CheckList(); static List<Class<?>> getChecks(); static List<Class<? extends JavaCheck>> getJavaChecks(); static List<Class<? extends DebugCheck>> getDebugChecks(); static List<Class<? extends JavaCheck>> getJavaTestChecks(); static List<Class<? extends SonarXmlCheck>> getXmlChecks(); static final String REPOSITORY_KEY; }