### Question:
DetektRulesDefinition implements RulesDefinition { @Override public void define(Context context) { if (externalIssuesSupported) { RULE_LOADER.createExternalRuleRepository(context); } } DetektRulesDefinition(boolean externalIssuesSupported); @Override void define(Context context);  }### Answer:
@Test public void external_repositories_not_supported() { RulesDefinition.Context context = new RulesDefinition.Context(); DetektRulesDefinition rulesDefinition = new DetektRulesDefinition(false); rulesDefinition.define(context); assertThat(context.repositories()).isEmpty(); }
@Test public void detekt_external_repository() { RulesDefinition.Context context = new RulesDefinition.Context(); DetektRulesDefinition rulesDefinition = new DetektRulesDefinition(true); rulesDefinition.define(context); assertThat(context.repositories()).hasSize(1); RulesDefinition.Repository repository = context.repository("external_detekt"); assertThat(repository.name()).isEqualTo("detekt"); assertThat(repository.language()).isEqualTo("kotlin"); assertThat(repository.isExternal()).isEqualTo(true); assertThat(repository.rules().size()).isEqualTo(111); RulesDefinition.Rule classNaming = repository.rule("ClassNaming"); assertThat(classNaming).isNotNull(); assertThat(classNaming.name()).isEqualTo("Class Naming"); assertThat(classNaming.type()).isEqualTo(RuleType.CODE_SMELL); assertThat(classNaming.severity()).isEqualTo("INFO"); assertThat(classNaming.htmlDescription()).isEqualTo("<p>A classes name should fit the naming pattern defined in the projects configuration.</p> " + "<p>See more at the <a href=\"https: assertThat(classNaming.tags()).containsExactlyInAnyOrder("style"); assertThat(classNaming.debtRemediationFunction().baseEffort()).isEqualTo("5min"); }