diff --git a/README.md b/README.md index 1faed27..a21b726 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,6 @@ $ ./gradlew gem # -t to watch change of files and rebuild continuously ## Development ``` -$ ./gradew build -$ ./gradew test +$ ./gradlew build +$ ./gradlew test ``` diff --git a/src/main/java/org/embulk/input/kintone/KintoneAccessor.java b/src/main/java/org/embulk/input/kintone/KintoneAccessor.java index 8aa7147..d1baf14 100644 --- a/src/main/java/org/embulk/input/kintone/KintoneAccessor.java +++ b/src/main/java/org/embulk/input/kintone/KintoneAccessor.java @@ -87,7 +87,7 @@ private String getAsString(final String fieldCode) case NUMBER: return toString(record.getNumberFieldValue(fieldCode), BigDecimal::toString); case CALC: - return toString(record.getCalcFieldValue(fieldCode), BigDecimal::toString); + return record.getCalcFieldRawValue(fieldCode); case CHECK_BOX: return toString(record.getCheckBoxFieldValue(fieldCode)); case RADIO_BUTTON: diff --git a/src/test/java/org/embulk/input/kintone/TestKintoneAccessor.java b/src/test/java/org/embulk/input/kintone/TestKintoneAccessor.java index f706a52..bc2c3dd 100644 --- a/src/test/java/org/embulk/input/kintone/TestKintoneAccessor.java +++ b/src/test/java/org/embulk/input/kintone/TestKintoneAccessor.java @@ -106,7 +106,12 @@ public Record createTestRecord() testRecord.putField("作成日時", new CreatedTimeFieldValue(ZonedDateTime.parse("2012-01-11T11:30:00Z"))); testRecord.putField("更新者", new ModifierFieldValue(modifier)); testRecord.putField("更新日時", new UpdatedTimeFieldValue(ZonedDateTime.parse("2012-01-11T11:30:00Z"))); - testRecord.putField("計算", new CalcFieldValue(new BigDecimal("1.23E-12"))); + testRecord.putField("計算(Calc)", new CalcFieldValue("1.23E-12")); + testRecord.putField("数値(Calc)", new CalcFieldValue("1234")); + testRecord.putField("日時(Calc)", new CalcFieldValue("2012-01-11T11:30:00Z")); + testRecord.putField("日付(Calc)", new CalcFieldValue("2012-01-11")); + testRecord.putField("時刻(Calc)", new CalcFieldValue("11:30")); + testRecord.putField("時間(Calc)", new CalcFieldValue("49:30")); FileBody body1 = new FileBody(); body1.setFileKey("sample_file1"); FileBody body2 = new FileBody(); @@ -153,7 +158,12 @@ public void testAccess() assertEquals("2012-01-11T11:30:00Z", accessor.get("作成日時")); assertEquals("code10", accessor.get("更新者")); assertEquals("2012-01-11T11:30:00Z", accessor.get("更新日時")); - assertEquals("1.23E-12", accessor.get("計算")); + assertEquals("1.23E-12", accessor.get("計算(Calc)")); + assertEquals("1234", accessor.get("数値(Calc)")); + assertEquals("2012-01-11T11:30:00Z", accessor.get("日時(Calc)")); + assertEquals("2012-01-11", accessor.get("日付(Calc)")); + assertEquals("11:30", accessor.get("時刻(Calc)")); + assertEquals("49:30", accessor.get("時間(Calc)")); assertEquals("sample_file1\nsample_file2", accessor.get("添付ファイル")); assertEquals("sample_category1\nsample_category2", accessor.get("カテゴリー")); assertEquals("sample_status", accessor.get("ステータス"));