Allow format() for types Integer and Long to handle string input

This commit is contained in:
rob
2021-09-02 11:44:51 +12:00
parent 1062adede4
commit bf3c1629f7
4 changed files with 54 additions and 0 deletions
@@ -0,0 +1,22 @@
package io.ebeaninternal.server.type;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class ScalarTypeIntegerTest {
private final ScalarTypeInteger type = new ScalarTypeInteger();
@Test
public void format_when_string() {
assertThat(type.format("1")).isEqualTo("1");
}
@Test
public void format_when_integer() {
assertThat(type.format(1)).isEqualTo("1");
}
}
@@ -0,0 +1,22 @@
package io.ebeaninternal.server.type;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class ScalarTypeLongTest {
private final ScalarTypeLong type = new ScalarTypeLong();
@Test
public void format_when_string() {
assertThat(type.format("1")).isEqualTo("1");
}
@Test
public void format_when_long() {
assertThat(type.format(1L)).isEqualTo("1");
}
}