-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AVRO-2385: generate camelCase method names for UPPER_SNAKE fields #735
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -927,6 +927,32 @@ public void testAdditionalToolsAreInjectedIntoTemplate() throws Exception { | |
} | ||
|
||
@Test | ||
public void testCamelize() { | ||
assertEquals("snakeCase", SpecificCompiler.camelize("snake_case", false)); | ||
assertEquals("constantCase", SpecificCompiler.camelize("CONSTANT_CASE", false)); | ||
assertEquals("mixedSnake", SpecificCompiler.camelize("Mixed_Snake", false)); | ||
assertEquals("snakeUuid", SpecificCompiler.camelize("snake_UUID", false)); | ||
assertEquals("lower", SpecificCompiler.camelize("lower", false)); | ||
assertEquals("capitalized", SpecificCompiler.camelize("Capitalized", false)); | ||
assertEquals("caps", SpecificCompiler.camelize("CAPS", false)); | ||
assertEquals("camelCased", SpecificCompiler.camelize("camelCased", false)); | ||
assertEquals("camelCased", SpecificCompiler.camelize("CamelCased", false)); | ||
martin-g marked this conversation as resolved.
Show resolved
Hide resolved
|
||
assertEquals("someUUID", SpecificCompiler.camelize("someUUID", false)); | ||
assertEquals("uuidFirst", SpecificCompiler.camelize("UUIDFirst", false)); | ||
|
||
assertEquals("SnakeCase", SpecificCompiler.camelize("snake_case", true)); | ||
assertEquals("ConstantCase", SpecificCompiler.camelize("CONSTANT_CASE", true)); | ||
assertEquals("MixedSnake", SpecificCompiler.camelize("Mixed_Snake", true)); | ||
assertEquals("SnakeUuid", SpecificCompiler.camelize("snake_UUID", true)); | ||
assertEquals("Lower", SpecificCompiler.camelize("lower", true)); | ||
assertEquals("Capitalized", SpecificCompiler.camelize("Capitalized", true)); | ||
assertEquals("CAPS", SpecificCompiler.camelize("CAPS", true)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this intentional ? |
||
assertEquals("CamelCased", SpecificCompiler.camelize("camelCased", true)); | ||
assertEquals("CamelCased", SpecificCompiler.camelize("CamelCased", true)); | ||
martin-g marked this conversation as resolved.
Show resolved
Hide resolved
|
||
assertEquals("SomeUUID", SpecificCompiler.camelize("someUUID", true)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as form |
||
assertEquals("UUIDFirst", SpecificCompiler.camelize("UUIDFirst", true)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same |
||
} | ||
|
||
public void testPojoWithUUID() throws IOException { | ||
SpecificCompiler compiler = createCompiler(); | ||
compiler.setOptionalGettersForNullableFieldsOnly(true); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And what about MIXED_CamelCasedTYPED ? :)
Shouldn't it be better to split at start, then ignore part that contains only '_'
I suggest