MySQLYearBinlogProtocolValue implements MySQLBinlogProtocolValue { @Override public Serializable read(final MySQLBinlogColumnDef columnDef, final MySQLPacketPayload payload) { int result = payload.readInt1(); return 0 == result ? MySQLTimeValueUtil.YEAR_OF_ZERO : Integer.toString(result + 1900); }  @Override Serializable read(final MySQLBinlogColumnDef columnDef, final MySQLPacketPayload payload);  }
@Test public void assertRead() { when(payload.readInt1()).thenReturn(1); assertThat(new MySQLYearBinlogProtocolValue().read(columnDef, payload), is("1901")); }
@Test public void assertReadNullYear() { when(payload.readInt1()).thenReturn(0); assertThat(new MySQLYearBinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtil.YEAR_OF_ZERO)); }