diff --git a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/BuilderConfigurationTest.java b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/BuilderConfigurationTest.java index 294cb87..9279196 100644 --- a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/BuilderConfigurationTest.java +++ b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/BuilderConfigurationTest.java @@ -4,8 +4,14 @@ import com.google.common.reflect.ClassPath; import org.junit.Test; import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; /** * Tests for {@link BuilderConfiguration}. @@ -21,4 +27,21 @@ public class BuilderConfigurationTest { //then assertThat(classPath).isNotNull(); } + + @Test + public void canGetCheckClasses() { + //given + final PackageScanner packageScanner = mock(PackageScanner.class); + final String checkstyleClass = "checkstyle class"; + given(packageScanner.apply(RuleSource.CHECKSTYLE)).willReturn(Stream.of(checkstyleClass)); + final String sevntuClass = "sevntu class"; + given(packageScanner.apply(RuleSource.SEVNTU)).willReturn(Stream.of(sevntuClass)); + //when + final Map> checkClasses = new BuilderConfiguration().checkClasses(packageScanner); + //then + assertThat(checkClasses).containsOnlyKeys(RuleSource.values()); + assertThat(checkClasses) + .containsEntry(RuleSource.CHECKSTYLE, Collections.singletonList(checkstyleClass)) + .containsEntry(RuleSource.SEVNTU, Collections.singletonList(sevntuClass)); + } }