### Question:
DexCloseOrderTransaction extends DEX { @Override public void applyAttachment(Transaction transaction, Account senderAccount, Account recipientAccount) { DexCloseOrderAttachment attachment = (DexCloseOrderAttachment) transaction.getAttachment(); DexService dexService = lookupDexService(); ExchangeContract contract = dexService.getDexContractById(attachment.getContractId()); long orderId = senderAccount.getId() == contract.getSender() ? contract.getOrderId() : contract.getCounterOrderId(); dexService.closeOrder(orderId); }  @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 testApplyAttachment() { Transaction tx = mock(Transaction.class); doReturn(attachment).when(tx).getAttachment(); doReturn(contract).when(dexService).getDexContractById(10L); Account sender = mock(Account.class); doReturn(1000L).when(sender).getId(); transactionType.applyAttachment(tx, sender, null); verify(dexService).closeOrder(200); doReturn(2000L).when(sender).getId(); transactionType.applyAttachment(tx, sender, null); verify(dexService).closeOrder(200); }