Search in sources :

Example 1 with BleutradeMarketsReturn

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");
}
Also used : BleutradeMarketsReturn(org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarketsReturn) Test(org.junit.Test)

Example 2 with BleutradeMarketsReturn

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);
}
Also used : BleutradeMarketsReturn(org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarketsReturn) CurrencyPair(org.knowm.xchange.currency.CurrencyPair) Test(org.junit.Test)

Example 3 with BleutradeMarketsReturn

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]);
    }
}
Also used : BleutradeMarket(org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarket) BleutradeMarketsReturn(org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarketsReturn) Test(org.junit.Test)

Example 4 with BleutradeMarketsReturn

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);
}
Also used : BleutradeMarketsReturn(org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarketsReturn) Test(org.junit.Test)

Example 5 with BleutradeMarketsReturn

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);
}
Also used : BleutradeMarketsReturn(org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarketsReturn) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)7 BleutradeMarketsReturn (org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarketsReturn)7 CurrencyPair (org.knowm.xchange.currency.CurrencyPair)3 BleutradeCurrenciesReturn (org.knowm.xchange.bleutrade.dto.marketdata.BleutradeCurrenciesReturn)2 Currency (org.knowm.xchange.currency.Currency)2 CurrencyMetaData (org.knowm.xchange.dto.meta.CurrencyMetaData)2 CurrencyPairMetaData (org.knowm.xchange.dto.meta.CurrencyPairMetaData)2 BigDecimal (java.math.BigDecimal)1 BleutradeMarket (org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarket)1 ExchangeMetaData (org.knowm.xchange.dto.meta.ExchangeMetaData)1 ClientConfig (si.mazi.rescu.ClientConfig)1 IRestProxyFactory (si.mazi.rescu.IRestProxyFactory)1