YahooQuoteToStockQuoteConverter implements Converter<YahooQuote, StockQuote> { @Override public StockQuote convert(YahooQuote yahooQuote) { StockQuote stockQuote = new StockQuote(); stockQuote.setHigh(yahooQuote.getHigh()); stockQuote.setLow(yahooQuote.getLow()); stockQuote.setLastChange(yahooQuote.getLastChange()); stockQuote.setLastChangePercent(yahooQuote.getLastChangePercent()); stockQuote.setPreviousClose(yahooQuote.getPreviousClose()); stockQuote.setOpen(yahooQuote.getOpen()); stockQuote.setExchange(yahooQuote.getExchange()); stockQuote.setCurrency(yahooQuote.getCurrency()); return stockQuote; }  @Override StockQuote convert(YahooQuote yahooQuote);  }
@Test public void essentialDataTransfered(){ YahooQuote yahooQuote = new YahooQuote.Builder() .withCurrency(CURRENCY_VALUE) .withExchange(EXCHANGE_VALUE) .withHigh(HIGH_VALUE) .withLastChange(LAST_CHANGE_VALUE) .withLastChangePercent(LAST_CHANGE_PERCENT_VALUE) .withLow(LOW_VALUE) .withOpen(OPEN_VALUE) .withPreviousClose(PREVIOUS_CLOSE_VALUE) .build(); StockQuote stockQuote = converter.convert(yahooQuote); assertEquals(HIGH_VALUE, stockQuote.getHigh(), DELTA_COMPARISON); assertEquals(LOW_VALUE, stockQuote.getLow(), DELTA_COMPARISON); assertEquals(LAST_CHANGE_VALUE, stockQuote.getLastChange(), DELTA_COMPARISON); assertEquals(LAST_CHANGE_PERCENT_VALUE, stockQuote.getLastChangePercent(), DELTA_COMPARISON); assertEquals(PREVIOUS_CLOSE_VALUE, stockQuote.getPreviousClose(), DELTA_COMPARISON); assertEquals(OPEN_VALUE, stockQuote.getOpen(), DELTA_COMPARISON); assertEquals(CURRENCY_VALUE, stockQuote.getCurrency()); assertEquals(EXCHANGE_VALUE, stockQuote.getExchange()); }