Search in sources :

Example 1 with RegistrarContext

use of org.sonar.plugins.java.api.CheckRegistrar.RegistrarContext in project JavaForFun by gumartinm.

the class CustomRulesCheckRegistrarTest method whenCreatingCustomJavaCheckRegistrarThenGenerateClassWithSuccess.

@Test
public void whenCreatingCustomJavaCheckRegistrarThenGenerateClassWithSuccess() {
    CustomRulesCheckRegistrar registrar = new CustomRulesCheckRegistrar();
    RegistrarContext registrarContext = new CheckRegistrar.RegistrarContext();
    registrar.register(registrarContext);
    List<Class<? extends JavaCheck>> checkClasses = Lists.newArrayList(registrarContext.checkClasses());
    List<Class<? extends JavaCheck>> testCheckClasses = Lists.newArrayList(registrarContext.testCheckClasses());
    assertThat(checkClasses.size(), is(2));
    assertThat(testCheckClasses.size(), is(0));
    assertThat(registrarContext.repositoryKey(), is(CheckList.REPOSITORY_KEY));
}
Also used : JavaCheck(org.sonar.plugins.java.api.JavaCheck) RegistrarContext(org.sonar.plugins.java.api.CheckRegistrar.RegistrarContext) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 RegistrarContext (org.sonar.plugins.java.api.CheckRegistrar.RegistrarContext)1 JavaCheck (org.sonar.plugins.java.api.JavaCheck)1