@Test public void shouldGenerateExpectedTestClassNames() throws Exception { assertThat(classNameGenerator.generate(featureFileName), equalTo(expectedClassName)); }
public String generate(final String featureFileName) { String fileNameWithNoExtension = FilenameUtils .removeExtension(featureFileName); fileNameWithNoExtension = fileNameWithNoExtension.replaceAll("_", "-"); fileNameWithNoExtension = fileNameWithNoExtension.replaceAll(" ", ""); fileNameWithNoExtension = fileNameWithNoExtension.replaceAll("\\.", "-"); String className = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, fileNameWithNoExtension); final Matcher startsWithDigitCheck = startsWithDigit.matcher(className); if (startsWithDigitCheck.matches()) { className = "_" + className; } return className; }
FeatureFileClassNamingScheme implements ClassNamingScheme { public String generate(final String featureFileName) { String fileNameWithNoExtension = FilenameUtils .removeExtension(featureFileName); fileNameWithNoExtension = fileNameWithNoExtension.replaceAll("_", "-"); fileNameWithNoExtension = fileNameWithNoExtension.replaceAll(" ", ""); fileNameWithNoExtension = fileNameWithNoExtension.replaceAll("\\.", "-"); String className = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, fileNameWithNoExtension); final Matcher startsWithDigitCheck = startsWithDigit.matcher(className); if (startsWithDigitCheck.matches()) { className = "_" + className; } return className; } }
FeatureFileClassNamingScheme implements ClassNamingScheme { public String generate(final String featureFileName) { String fileNameWithNoExtension = FilenameUtils .removeExtension(featureFileName); fileNameWithNoExtension = fileNameWithNoExtension.replaceAll("_", "-"); fileNameWithNoExtension = fileNameWithNoExtension.replaceAll(" ", ""); fileNameWithNoExtension = fileNameWithNoExtension.replaceAll("\\.", "-"); String className = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, fileNameWithNoExtension); final Matcher startsWithDigitCheck = startsWithDigit.matcher(className); if (startsWithDigitCheck.matches()) { className = "_" + className; } return className; } FeatureFileClassNamingScheme(); }
FeatureFileClassNamingScheme implements ClassNamingScheme { public String generate(final String featureFileName) { String fileNameWithNoExtension = FilenameUtils .removeExtension(featureFileName); fileNameWithNoExtension = fileNameWithNoExtension.replaceAll("_", "-"); fileNameWithNoExtension = fileNameWithNoExtension.replaceAll(" ", ""); fileNameWithNoExtension = fileNameWithNoExtension.replaceAll("\\.", "-"); String className = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, fileNameWithNoExtension); final Matcher startsWithDigitCheck = startsWithDigit.matcher(className); if (startsWithDigitCheck.matches()) { className = "_" + className; } return className; } FeatureFileClassNamingScheme(); String generate(final String featureFileName); }
FeatureFileClassNamingScheme implements ClassNamingScheme { public String generate(final String featureFileName) { String fileNameWithNoExtension = FilenameUtils .removeExtension(featureFileName); fileNameWithNoExtension = fileNameWithNoExtension.replaceAll("_", "-"); fileNameWithNoExtension = fileNameWithNoExtension.replaceAll(" ", ""); fileNameWithNoExtension = fileNameWithNoExtension.replaceAll("\\.", "-"); String className = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, fileNameWithNoExtension); final Matcher startsWithDigitCheck = startsWithDigit.matcher(className); if (startsWithDigitCheck.matches()) { className = "_" + className; } return className; } FeatureFileClassNamingScheme(); String generate(final String featureFileName);  }