Skip to content

Commit

Permalink
Add tests for missing underscores for PascalCase enum values OpenAPIT…
Browse files Browse the repository at this point in the history
  • Loading branch information
renatomameli committed May 7, 2024
1 parent 1d4bb17 commit 77a6738
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ public void toEnumVarNameShouldNotResultInSingleUnderscore() throws Exception {
Assert.assertEquals(fakeJavaCodegen.toEnumVarName("==", "String"), "u");
}

@Test
public void testEnumVarNameUnderscoreIfValueIsPascalCase() {
Assert.assertEquals(fakeJavaCodegen.toEnumVarName("OnlyCamelCase", "String"), "ONLY_CAMEL_CASE");
Assert.assertEquals(fakeJavaCodegen.toEnumVarName("WithNumber1", "String"), "WITH_NUMBER1");
Assert.assertEquals(fakeJavaCodegen.toEnumVarName("_LeadingUnderscore", "String"), "_LEADING_UNDERSCORE");
}

@Test
public void toVarNameShouldAvoidOverloadingGetClassMethod() throws Exception {
Assert.assertEquals(fakeJavaCodegen.toVarName("class"), "propertyClass");
Expand Down

0 comments on commit 77a6738

Please sign in to comment.