@Test void badHyphenCaseShouldReturnFalse() { String badHyphenCase1 = "my_variable"; String badHyphenCase2 = "myVariable"; String badHyphenCase3 = "my_Variable"; String badHyphenCase4 = "my__Variable_is_important"; String badHyphenCase5 = "_my_variable"; String badHyphenCase6 = "my_variable_"; boolean actual1 = validator.isNamingValid(badHyphenCase1, ValidatorParameters.NamingConvention.HyphenCase); boolean actual2 = validator.isNamingValid(badHyphenCase2, ValidatorParameters.NamingConvention.HyphenCase); boolean actual3 = validator.isNamingValid(badHyphenCase3, ValidatorParameters.NamingConvention.HyphenCase); boolean actual4 = validator.isNamingValid(badHyphenCase4, ValidatorParameters.NamingConvention.HyphenCase); boolean actual5 = validator.isNamingValid(badHyphenCase5, ValidatorParameters.NamingConvention.HyphenCase); boolean actual6 = validator.isNamingValid(badHyphenCase6, ValidatorParameters.NamingConvention.HyphenCase); Assertions.assertAll( () -> assertFalse(actual1), () -> assertFalse(actual2), () -> assertFalse(actual3), () -> assertFalse(actual4), () -> assertFalse(actual5), () -> assertFalse(actual6) ); }
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; }    }