@Test(expected = ShapeShiftException.class) public void testGetLimitFail() throws ShapeShiftException, IOException { server.enqueue(new MockResponse().setBody(GET_LIMIT_BTC_LTC_JSON)); // Incorrect pair shapeShift.getLimit(LTC, DOGE); }
@Test public void testGetLimit() throws ShapeShiftException, IOException, InterruptedException, JSONException { // Schedule some responses. server.enqueue(new MockResponse().setBody(GET_LIMIT_BTC_LTC_JSON)); ShapeShiftLimit limitReply = shapeShift.getLimit(BTC, LTC); assertFalse(limitReply.isError); assertEquals("btc_ltc", limitReply.pair); assertNotNull(limitReply.limit); assertEquals(BTC, limitReply.limit.type); assertEquals("5", limitReply.limit.toPlainString()); // Optional: confirm that your app made the HTTP requests you were expecting. RecordedRequest request = server.takeRequest(); assertEquals("/limit/btc_ltc", request.getPath()); }