mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1573 - Incorrect CamelCase conversion when number proceeds uppercase letter
This commit is contained in:
@@ -7,21 +7,36 @@ import static org.junit.Assert.assertEquals;
|
||||
public class CamelCaseHelperTest {
|
||||
|
||||
@Test
|
||||
public void when_underscore() throws Exception {
|
||||
|
||||
public void when_underscore() {
|
||||
assertEquals(CamelCaseHelper.toCamelFromUnderscore("hello_there"), "helloThere");
|
||||
assertEquals(CamelCaseHelper.toCamelFromUnderscore("hello_there_jim"), "helloThereJim");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_trailing_numbers() throws Exception {
|
||||
|
||||
public void when_trailing_numbers() {
|
||||
assertEquals(CamelCaseHelper.toCamelFromUnderscore("hello_1"), "hello1");
|
||||
assertEquals(CamelCaseHelper.toCamelFromUnderscore("hello_there_2"), "helloThere2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_already_camel() throws Exception {
|
||||
public void when_numbers() {
|
||||
assertEquals(CamelCaseHelper.toCamelFromUnderscore("hello1_id"), "hello1Id");
|
||||
assertEquals(CamelCaseHelper.toCamelFromUnderscore("hello_there2_foo"), "helloThere2Foo");
|
||||
assertEquals(CamelCaseHelper.toCamelFromUnderscore("hello1id"), "hello1id");
|
||||
assertEquals(CamelCaseHelper.toCamelFromUnderscore("hello_there2foo"), "helloThere2foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_numbersProceedUppercase() {
|
||||
assertEquals(CamelCaseHelper.toCamelFromUnderscore("hello1_id"), "hello1Id");
|
||||
assertEquals(CamelCaseHelper.toCamelFromUnderscore("hello_there2_foo"), "helloThere2Foo");
|
||||
|
||||
assertEquals(CamelCaseHelper.toUnderscoreFromCamel("hello1Id"), "hello1_id");
|
||||
assertEquals(CamelCaseHelper.toUnderscoreFromCamel("helloThere2Foo"), "hello_there2_foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void when_already_camel() {
|
||||
assertEquals(CamelCaseHelper.toCamelFromUnderscore("helloThere"), "helloThere");
|
||||
assertEquals(CamelCaseHelper.toCamelFromUnderscore("helloThereJim"), "helloThereJim");
|
||||
assertEquals(CamelCaseHelper.toCamelFromUnderscore("hello"), "hello");
|
||||
|
||||
Reference in New Issue
Block a user