TransactionJsonToTableRow implements SerializableFunction<String, TableRow> { @Override public TableRow apply(String json) { try { TableRow tableRow = MAPPER.readValue(json, TableRow.class); long consensusTimestamp =((Long) tableRow.get("consensusTimestamp")); updateMetrics(consensusTimestamp); tableRow.put("consensusTimestampTruncated", Instant.ofEpochSecond(0L, (consensusTimestamp / 1000) * 1000L).toString()); LOG.trace("Table Row: {}", tableRow.toPrettyString()); return tableRow; } catch (Exception e) { jsonToTableRowErrors.inc(); LOG.error("Error converting json to TableRow. Json: " + json, e); throw new IllegalArgumentException("Error converting json to TableRow", e); } }  @Override TableRow apply(String json);  }
@Test void testThrowsExceptionForBadJson() throws Exception { String badJson = "{\"consensusTimestamp\":1570802944412586000,\"entity\":{\"shardNum\":0,"; assertThrows(IllegalArgumentException.class, () -> { converter.apply(badJson); }); }