IntegerSerde implements Serde<Integer> { public void decrement(final ByteBuffer byteBuffer) { int val = byteBuffer.getInt(); byteBuffer.flip(); byteBuffer.putInt(val - 1); byteBuffer.flip(); }  @Override Integer deserialize(final ByteBuffer byteBuffer); @Override void serialize(final ByteBuffer byteBuffer, final Integer val); void increment(final ByteBuffer byteBuffer); void decrement(final ByteBuffer byteBuffer);  }
@Test void testDecrement() { int input = 10; ByteBuffer inputBuf = serialize(input); getSerde().decrement(inputBuf); Integer output = deserialize(inputBuf); assertThat(output).isEqualTo(input - 1); }