MySQLDatetimeBinlogProtocolValue implements MySQLBinlogProtocolValue { @Override public Serializable read(final MySQLBinlogColumnDef columnDef, final MySQLPacketPayload payload) { long datetime = payload.readInt8(); return 0 == datetime ? MySQLTimeValueUtil.DATETIME_OF_ZERO : String.format("%s %s", readDate((int) (datetime / 1000000)), readTime((int) (datetime % 1000000))); }  @Override Serializable read(final MySQLBinlogColumnDef columnDef, final MySQLPacketPayload payload);  }
@Test public void assertRead() { when(payload.readInt8()).thenReturn(99991231235959L); assertThat(new MySQLDatetimeBinlogProtocolValue().read(columnDef, payload), is("9999-12-31 23:59:59")); }
@Test public void assertReadNullTime() { when(payload.readInt8()).thenReturn(0L); assertThat(new MySQLDatetimeBinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtil.DATETIME_OF_ZERO)); }