### Question:
MoveVariantOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.MOVE); dos.writeLong(to); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); } os.flush(); return os.toByteArray(); } MoveVariantOp(DataInputStream dis);  MoveVariantOp(long to, VariantSpan variantSpan); @Override byte[] encode(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); final long to; final VariantSpan variantSpan; }### Answer:
@Test public void encodeDecode() throws Exception { MoveVariantOp op = new MoveVariantOp(100, new VariantSpan(50, 75)); byte[] data = op.encode(); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(data)); assertEquals(Op.MOVE, dis.readByte()); MoveVariantOp decoded = new MoveVariantOp(dis); assertEquals(op, decoded); }