SelectorNamingConventionCheck extends DoubleDispatchVisitorCheck { @VisibleForTesting void setFormat(String format) { this.format = format; }  @Override void visitClassSelector(ClassSelectorTree tree); @Override void visitIdSelector(IdSelectorTree tree); @Override void visitScssPlaceholderSelector(ScssPlaceholderSelectorTree tree); @Override void validateParameters();  }
@Test public void test_with_default_format() { check.setFormat("^[a-z][-a-z0-9]*$"); CssCheckVerifier.verifyCssFile(check, getTestFile("selectorNamingConvention.css")); }
@Test public void test_with_custom_format() { check.setFormat("^[-a-z]+$"); CssCheckVerifier.verifyCssFile(check, getTestFile("selectorNamingConventionCustomFormat.css")); }
@Test public void test_scss_placeholder() { check.setFormat("^[-a-z]+$"); CssCheckVerifier.verifyScssFile(check, getTestFile("selectorNamingConventionScssPlaceholder.scss")); }
@Test public void test_interpolated_selectors_not_checked_on_less_file() { check.setFormat("^[a-z][-a-z0-9]*$"); CssCheckVerifier.verifyLessFile(check, getTestFile("selectorNamingConvention.less")); }
@Test public void should_throw_an_illegal_state_exception_as_the_format_parameter_is_not_valid() { try { check.setFormat("("); CssCheckVerifier.issuesOnCssFile(check, CheckTestUtils.getCommonTestFile("selectorNamingConvention/selectorNamingConvention.css")).noMore(); } catch (IllegalStateException e) { assertThat(e.getMessage()).isEqualTo("Check css:selector-naming-convention (Selectors should follow a naming convention): " + "format parameter \"(\" is not a valid regular expression."); } }