### Question:
DexCloseOrderTransaction extends DEX { @Override public AbstractAttachment parseAttachment(ByteBuffer buffer) throws AplException.NotValidException { return new DexCloseOrderAttachment(buffer); }  @Override byte getSubtype(); @Override LedgerEvent getLedgerEvent(); @Override AbstractAttachment parseAttachment(ByteBuffer buffer); @Override AbstractAttachment parseAttachment(JSONObject attachmentData); @Override void validateAttachment(Transaction tx); @Override boolean applyAttachmentUnconfirmed(Transaction transaction, Account senderAccount); @Override void applyAttachment(Transaction transaction, Account senderAccount, Account recipientAccount); @Override void undoAttachmentUnconfirmed(Transaction transaction, Account senderAccount); @Override boolean isDuplicate(Transaction transaction, Map<TransactionType, Map<String, Integer>> duplicates); @Override boolean canHaveRecipient(); @Override boolean isPhasingSafe(); @Override String getName();  }### Answer:
@Test void testParseAttachmentFromByteBuffer() throws AplException.NotValidException { ByteBuffer buffer = ByteBuffer.allocate(9); buffer.put((byte) 1); buffer.putLong(10); buffer.rewind(); AbstractAttachment parsedAttachment = transactionType.parseAttachment(buffer); assertEquals(attachment, parsedAttachment); }
@Test void testParseAttachmentFromJson() throws AplException.NotValidException { JSONObject object = new JSONObject(); object.put("version.DexCloseOrder", 1); object.put("contractId", "10"); AbstractAttachment parsedAttachment = transactionType.parseAttachment(object); assertEquals(attachment, parsedAttachment); }
@Test void testSerializeDeserializeToBytes() throws AplException.NotValidException { ByteBuffer buffer = ByteBuffer.allocate(9); attachment.putBytes(buffer); buffer.rewind(); AbstractAttachment parsedAttachment = transactionType.parseAttachment(buffer); assertEquals(attachment, parsedAttachment); }
@Test void testSerializeDeserializeToJson() throws AplException.NotValidException { JSONObject json = attachment.getJSONObject(); AbstractAttachment parsedAttachment = transactionType.parseAttachment(json); assertEquals(attachment, parsedAttachment); }