Merge pull request #1650 from ostephens/null-to-string

Null to string
This commit is contained in:
Jacky 2018-06-16 16:44:18 -04:00 committed by GitHub
commit c3fbc7e187
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -17,7 +17,7 @@ public class StringUtils {
OffsetDateTime odt = (OffsetDateTime)o; OffsetDateTime odt = (OffsetDateTime)o;
return odt.format(DateTimeFormatter.ofPattern(DEFAULT_PATTERN)); return odt.format(DateTimeFormatter.ofPattern(DEFAULT_PATTERN));
} else if (o == null) { } else if (o == null) {
return "null"; return "";
} else { } else {
return o.toString(); return o.toString();
} }

View File

@ -112,7 +112,7 @@ public class ToFromConversionTests extends RefineTest {
@Test @Test
public void testToString() throws CalendarParserException { public void testToString() throws CalendarParserException {
Assert.assertTrue(invoke("toString") instanceof EvalError); Assert.assertTrue(invoke("toString") instanceof EvalError);
Assert.assertEquals(invoke("toString", (Object) null), "null"); Assert.assertEquals(invoke("toString", (Object) null), "");
Assert.assertEquals(invoke("toString", Long.valueOf(100)),"100"); Assert.assertEquals(invoke("toString", Long.valueOf(100)),"100");
Assert.assertEquals(invoke("toString", Double.valueOf(100.0)),"100.0"); Assert.assertEquals(invoke("toString", Double.valueOf(100.0)),"100.0");
Assert.assertEquals(invoke("toString", Double.valueOf(100.0),"%.0f"),"100"); Assert.assertEquals(invoke("toString", Double.valueOf(100.0),"%.0f"),"100");