use of org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarketsReturn in project XChange by knowm.
the class BleutradeMarketDataServiceIntegration method shouldFailOnUnsuccesfulGetMarkets.
@Test(expected = ExchangeException.class)
public void shouldFailOnUnsuccesfulGetMarkets() throws IOException {
// given
BleutradeMarketsReturn marketsReturn = new BleutradeMarketsReturn();
marketsReturn.setSuccess(false);
marketsReturn.setMessage("test message");
marketsReturn.setResult(expectedBleutradeMarkets());
when(bleutrade.getBleutradeMarkets()).thenReturn(marketsReturn);
// when
marketDataService.getBleutradeMarkets();
// then
fail("BleutradeMarketDataService should throw ExchangeException when markets request was unsuccessful");
}
use of org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarketsReturn in project XChange by knowm.
the class BleutradeAdaptersTest method shouldAdaptMarkets.
@Test
public void shouldAdaptMarkets() throws IOException {
// given
final BleutradeMarketsReturn response = parse(BleutradeMarketsReturn.class);
// when
Set<CurrencyPair> currencyPairs = BleutradeAdapters.adaptBleutradeCurrencyPairs(response);
// then
assertThat(currencyPairs).hasSize(2);
assertThat(currencyPairs).contains(CurrencyPair.DOGE_BTC, BLEU_BTC_CP);
}
use of org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarketsReturn in project XChange by knowm.
the class BleutradeMarketDataServiceIntegration method shouldGetMarkets.
@Test
public void shouldGetMarkets() throws IOException {
// given
final List<BleutradeMarket> expectedBleutradeMarkets = expectedBleutradeMarkets();
final String[] expectedBleutradeMarketsStr = expectedBleutradeMarketsStr();
BleutradeMarketsReturn marketsReturn = new BleutradeMarketsReturn();
marketsReturn.setSuccess(true);
marketsReturn.setMessage("test message");
marketsReturn.setResult(expectedBleutradeMarkets);
when(bleutrade.getBleutradeMarkets()).thenReturn(marketsReturn);
// when
List<BleutradeMarket> markets = marketDataService.getBleutradeMarkets();
// then
assertThat(markets).hasSize(2);
for (int i = 0; i < markets.size(); i++) {
BleutradeAssert.assertEquals(markets.get(i), expectedBleutradeMarkets.get(i));
assertThat(markets.get(i).toString()).isEqualTo(expectedBleutradeMarketsStr[i]);
}
}
use of org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarketsReturn in project XChange by knowm.
the class BleutradeDtoTest method shouldParseMarketsReturn.
@Test
public void shouldParseMarketsReturn() throws IOException {
// when
final BleutradeMarketsReturn response = parse(BleutradeMarketsReturn.class);
// then
assertThat(response.toString()).isEqualTo(MARKETS_RETURN_STR);
}
use of org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarketsReturn in project XChange by knowm.
the class BleutradeExtendedDtoTest method shouldParseExtendedMarketsReturn.
@Test
public void shouldParseExtendedMarketsReturn() throws IOException {
// when
final BleutradeMarketsReturn response = parse("org/knowm/xchange/bleutrade/dto/" + "ExtendedMarketsReturn", BleutradeMarketsReturn.class);
// then
assertThat(response.toString()).isEqualTo(MARKETS_RETURN_STR);
}
Aggregations