### Question:
AndroidLintRulesDefinition implements RulesDefinition { @Override public void define(Context context) { if (externalIssuesSupported) { RULE_LOADER.createExternalRuleRepository(context); } } AndroidLintRulesDefinition(boolean externalIssuesSupported); @Override void define(Context context);  }### Answer:
@Test public void external_repositories_not_supported() { RulesDefinition.Context context = new RulesDefinition.Context(); AndroidLintRulesDefinition rulesDefinition = new AndroidLintRulesDefinition(false); rulesDefinition.define(context); assertThat(context.repositories()).isEmpty(); }
@Test public void android_lint_external_repository() { RulesDefinition.Context context = new RulesDefinition.Context(); AndroidLintRulesDefinition rulesDefinition = new AndroidLintRulesDefinition(true); rulesDefinition.define(context); assertThat(context.repositories()).hasSize(1); RulesDefinition.Repository repository = context.repository("external_android-lint"); assertThat(repository.name()).isEqualTo("Android Lint"); assertThat(repository.language()).isEqualTo("kotlin"); assertThat(repository.isExternal()).isEqualTo(true); assertThat(repository.rules().size()).isEqualTo(313); RulesDefinition.Rule rule = repository.rule("AaptCrash"); assertThat(rule).isNotNull(); assertThat(rule.name()).isEqualTo("Potential AAPT crash"); assertThat(rule.type()).isEqualTo(RuleType.BUG); assertThat(rule.severity()).isEqualTo("CRITICAL"); assertThat(rule.htmlDescription()).isEqualTo( "<p>\n" + "Defining a style which sets android:id to a dynamically generated id can cause\n" + "many versions of aapt, the resource packaging tool, to crash. To work around\n" + "this, declare the id explicitly with &lt;item type=&quot;id&quot; name=&quot;...&quot; /&gt; instead.\n" + "</p>\n" + "<p>\n" + "More information: <br />\n" + "<a href=\"https: "</p>"); assertThat(rule.tags()).containsExactlyInAnyOrder("android"); assertThat(rule.debtRemediationFunction().baseEffort()).isEqualTo("5min"); }