@Test
public void testFixedAmountTransaction() throws ShapeShiftException, IOException,
InterruptedException, JSONException, AddressMalformedException {
server.enqueue(new MockResponse().setBody(FIXED_AMOUNT_TRANSACTION_JSON));
AbstractAddress withdrawal = DOGE.newAddress("DMHLQYG4j96V8cZX9WSuXxLs5RnZn6ibrV");
AbstractAddress refund = BTC.newAddress("1Nz4xHJjNCnZFPjRUq8CN4BZEXTgLZfeUW");
Value amount = DOGE.value("1000");
ShapeShiftAmountTx amountTxReply = shapeShift.exchangeForAmount(amount, withdrawal, refund);
assertFalse(amountTxReply.isError);
assertEquals("btc_doge", amountTxReply.pair);
assertEquals("14gQ3xywKEUA6CfH61F8t2c6oB5nLnUjL5", amountTxReply.deposit.toString());
assertEquals(BTC, amountTxReply.deposit.getType());
assertEquals("0.00052379", amountTxReply.depositAmount.toPlainString());
assertEquals(BTC, amountTxReply.depositAmount.type);
assertEquals(withdrawal.toString(), amountTxReply.withdrawal.toString());
assertEquals(DOGE, amountTxReply.withdrawal.getType());
assertEquals(amount.toPlainString(), amountTxReply.withdrawalAmount.toPlainString());
assertEquals(DOGE, amountTxReply.withdrawalAmount.type);
assertEquals(1427149038191L, amountTxReply.expiration.getTime());
assertEquals(BTC.value(".00052379"), amountTxReply.rate.convert(Value.parse(DOGE, "1000")));
RecordedRequest request = server.takeRequest();
assertEquals("/sendamount", request.getPath());
JSONObject reqJson = new JSONObject(request.getBody().readUtf8());
assertEquals(withdrawal.toString(), reqJson.getString("withdrawal"));
assertEquals(refund.toString(), reqJson.getString("returnAddress"));
assertEquals("btc_doge", reqJson.getString("pair"));
assertEquals(amount.toPlainString(), reqJson.getString("amount"));
}