SecondaryLock extends ThemisLock { @Override public boolean equals(Object other) { if (!(other instanceof SecondaryLock)) { return false; } ThemisLock lock = (ThemisLock)other; return super.equals(lock) && !lock.isPrimary() && this.primaryColumn.equals(((SecondaryLock) other).getPrimaryColumn()); } SecondaryLock();  SecondaryLock(Type type); ColumnCoordinate getPrimaryColumn(); void setPrimaryColumn(ColumnCoordinate primaryColumn); @Override void write(DataOutput out); @Override void readFields(DataInput in); @Override boolean equals(Object other); @Override String toString(); @Override boolean isPrimary();  }
@Test public void testWriteAndReadSecondaryLock() throws IOException { SecondaryLock expect = getSecondaryLock(COLUMN); SecondaryLock actual = new SecondaryLock(); writeObjectToBufferAndRead(expect, actual); Assert.assertTrue(expect.equals(actual)); }
@Test public void testToByteAndParseFromByte() throws IOException { SecondaryLock expect = getSecondaryLock(COLUMN); byte[] lockByte = ThemisLock.toByte(expect); ThemisLock actual = ThemisLock.parseFromByte(lockByte); Assert.assertTrue(expect.equals(actual)); }