@Test void goodUnderscoreCaseShouldReturnTrue() { String goodUnderscoreCase1 = "my_variable"; String goodUnderscoreCase2 = "variable"; String goodUnderscoreCase3 = "my_super_variable"; boolean actual1 = validator.isNamingValid(goodUnderscoreCase1, ValidatorParameters.NamingConvention.UnderscoreCase); boolean actual2 = validator.isNamingValid(goodUnderscoreCase2, ValidatorParameters.NamingConvention.UnderscoreCase); boolean actual3 = validator.isNamingValid(goodUnderscoreCase3, ValidatorParameters.NamingConvention.UnderscoreCase); Assertions.assertAll( () -> assertTrue(actual1), () -> assertTrue(actual2), () -> assertTrue(actual3) ); }
boolean isNamingValid(String name, ValidatorParameters.NamingConvention namingStrategy) { switch (namingStrategy) { case UnderscoreCase: return isUnderscoreCase(name); case CamelCase: return isCamelCase(name); case HyphenCase: return isHyphenCase(name); } return false; }
NamingValidator { boolean isNamingValid(String name, ValidatorParameters.NamingConvention namingStrategy) { switch (namingStrategy) { case UnderscoreCase: return isUnderscoreCase(name); case CamelCase: return isCamelCase(name); case HyphenCase: return isHyphenCase(name); } return false; } }
NamingValidator { boolean isNamingValid(String name, ValidatorParameters.NamingConvention namingStrategy) { switch (namingStrategy) { case UnderscoreCase: return isUnderscoreCase(name); case CamelCase: return isCamelCase(name); case HyphenCase: return isHyphenCase(name); } return false; }  }
NamingValidator { boolean isNamingValid(String name, ValidatorParameters.NamingConvention namingStrategy) { switch (namingStrategy) { case UnderscoreCase: return isUnderscoreCase(name); case CamelCase: return isCamelCase(name); case HyphenCase: return isHyphenCase(name); } return false; }   }
NamingValidator { boolean isNamingValid(String name, ValidatorParameters.NamingConvention namingStrategy) { switch (namingStrategy) { case UnderscoreCase: return isUnderscoreCase(name); case CamelCase: return isCamelCase(name); case HyphenCase: return isHyphenCase(name); } return false; }    }