Skip to content

Commit

Permalink
Fix generated test class names
Browse files Browse the repository at this point in the history
  • Loading branch information
electrum committed May 14, 2020
1 parent 7a33e73 commit b56801c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ public ConventionBasedTest generateProxy(ConventionBasedTest conventionBasedTest

private String generatedClassName(ConventionBasedTest conventionBasedTest)
{
List<String> testNameParts = Splitter.on('.').splitToList(conventionBasedTest.getTestName());
List<String> testNameParts = Splitter.on('.').omitEmptyStrings().splitToList(conventionBasedTest.getTestName());
if (testNameParts.size() == 1) {
return testPackage;
}
return testPackage + "." + toJavaSymbol(testNameParts.get(testNameParts.size() - 2));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ class ConventionBasedTestProxyGeneratorTest

where:
testName | expectedClassName | expectedMethodName
'a' | 'io.prestosql.tempto' | 'a'
'.a' | 'io.prestosql.tempto' | 'a'
'a.b' | 'io.prestosql.tempto.a' | 'b'
'.a.b' | 'io.prestosql.tempto.a' | 'b'
'a.b.c' | 'io.prestosql.tempto.b' | 'c'
'a.b.c.d' | 'io.prestosql.tempto.c' | 'd'
'a.b.9c.1d' | 'io.prestosql.tempto._9c' | '_1d'
'a.b.ala ma kota.a-kot-ma ale' | 'io.prestosql.tempto.ala_ma_kota' | 'a_kot_ma_ale'
Expand Down

0 comments on commit b56801c

Please sign in to comment.