tradeWithdrawAddress == null || tradeWithdrawAmount == null) { ShapeShiftNormalTx normalTx = shapeShift.exchange(sendToAddress, refundAddress);
@Test(expected = ShapeShiftException.class) public void testNormalTransactionFail() throws ShapeShiftException, AddressMalformedException, IOException { server.enqueue(new MockResponse().setBody(NORMAL_TRANSACTION_JSON)); // Incorrect Dogecoin address, correct is DMHLQYG4j96V8cZX9WSuXxLs5RnZn6ibrV shapeShift.exchange(DOGE.newAddress("DSntbp199h851m3Y1g3ruYCQHzWYCZQmmA"), BTC.newAddress("1Nz4xHJjNCnZFPjRUq8CN4BZEXTgLZfeUW")); }
@Test public void testNormalTransaction() throws ShapeShiftException, IOException, InterruptedException, JSONException, AddressMalformedException { // Schedule some responses. server.enqueue(new MockResponse().setBody(NORMAL_TRANSACTION_JSON)); AbstractAddress withdrawal = DOGE.newAddress("DMHLQYG4j96V8cZX9WSuXxLs5RnZn6ibrV"); AbstractAddress refund = BTC.newAddress("1Nz4xHJjNCnZFPjRUq8CN4BZEXTgLZfeUW"); ShapeShiftNormalTx normalTxReply = shapeShift.exchange(withdrawal, refund); assertFalse(normalTxReply.isError); assertEquals("btc_doge", normalTxReply.pair); assertEquals("18ETaXCYhJ8sxurh41vpKC3E6Tu7oJ94q8", normalTxReply.deposit.toString()); assertEquals(BTC, normalTxReply.deposit.getType()); assertEquals(withdrawal.toString(), normalTxReply.withdrawal.toString()); assertEquals(DOGE, normalTxReply.withdrawal.getType()); // Optional: confirm that your app made the HTTP requests you were expecting. RecordedRequest request = server.takeRequest(); assertEquals("/shift", 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")); }