test_class.declarator: HISTO_AAPL = readFile("/provider/rate/yahoo/histo_aapl.json")
test_class.modifier: private static final
test_class.original_string: private static final String HISTO_AAPL = readFile("/provider/rate/yahoo/histo_aapl.json");
test_class.type: String
test_class.var_name: HISTO_AAPL
test_class.declarator: LATEST = readFile("/provider/rate/yahoo/latest.json")
test_class.modifier: private static final
test_class.original_string: private static final String LATEST = readFile("/provider/rate/yahoo/latest.json");
test_class.type: String
test_class.var_name: LATEST
test_class.declarator: LATEST_UBI = readFile("/provider/rate/yahoo/latest_ubi.json")
test_class.modifier: private static final
test_class.original_string: private static final String LATEST_UBI = readFile("/provider/rate/yahoo/latest_ubi.json");
test_class.type: String
test_class.var_name: LATEST_UBI
test_class.declarator: pairService
test_class.modifier: @Mock
  	private
test_class.original_string: @Mock
  	private PairService pairService;
test_class.type: PairService
test_class.var_name: pairService
test_class.declarator: yahooStock
test_class.modifier: @InjectMocks
  	private
test_class.original_string: @InjectMocks
  	private YahooStockProvider yahooStock;
test_class.type: YahooStockProvider
test_class.var_name: yahooStock
test_class.declarator: server
test_class.modifier: private
test_class.original_string: private MockRestServiceServer server;
test_class.type: MockRestServiceServer
test_class.var_name: server
test_class.file: trading-common/src/test/java/fr/ymanvieu/trading/common/provider/rate/yahoo/YahooStockProviderTest.java
test_class.identifier: YahooStockProviderTest
test_case.body: @Test
  	public void testGetRates() throws Exception {
  		server.expect(anything()).andRespond(withSuccess(LATEST, MediaType.APPLICATION_JSON));
  		
  		Quote expectedUbisoftRate = new Quote("UBI", EUR, new BigDecimal("57.52"), parse("2017-09-08T17:35:14+02:00"));
  		Quote expectedLitecoinRate = new Quote("LTC", USD, new BigDecimal("67.29928"), parse("2017-09-10T15:19:23+02:00"));
  		
  
  		var symbols = List.of(
  		new Pair().setSymbol("UBI.PA").setName("Ubi").setSource(new Symbol().setCode("UBI")).setTarget(new Symbol().setCode(EUR)).setProviderCode("YAHOO"),
  		new Pair().setSymbol("LTCUSD=X").setName("Litecoin").setSource(new Symbol().setCode("LTC")).setTarget(new Symbol().setCode(USD)).setProviderCode("YAHOO")
  		);
  		
  		when(pairService.getAllFromProvider(ArgumentMatchers.anyString())).thenReturn(symbols);
  
  		List<Quote> result = yahooStock.getRates();
  
  		assertThat(result).containsOnlyOnce(expectedLitecoinRate, expectedUbisoftRate);
  	}
test_case.class_method_signature: YahooStockProviderTest.testGetRates()
test_case.full_signature: @Test public void testGetRates()
test_case.identifier: testGetRates
test_case.invocations: andRespond expect anything withSuccess parse parse of setProviderCode setTarget setSource setName setSymbol setCode setCode setProviderCode setTarget setSource setName setSymbol setCode setCode thenReturn when getAllFromProvider anyString getRates containsOnlyOnce assertThat
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetRates()
focal_class.declarator: rt = new RestTemplate()
focal_class.modifier: private final
focal_class.original_string: private final RestTemplate rt = new RestTemplate();
focal_class.type: RestTemplate
focal_class.var_name: rt
focal_class.declarator: url
focal_class.modifier: @Value("${provider.yahoo.url.latest}")
  	private
focal_class.original_string: @Value("${provider.yahoo.url.latest}")
  	private String url;
focal_class.type: String
focal_class.var_name: url
focal_class.declarator: urlHistory
focal_class.modifier: @Value("${provider.yahoo.url.history}")
  	private
focal_class.original_string: @Value("${provider.yahoo.url.history}")
  	private String urlHistory;
focal_class.type: String
focal_class.var_name: urlHistory
focal_class.declarator: pairService
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private PairService pairService;
focal_class.type: PairService
focal_class.var_name: pairService
focal_class.file: trading-common/src/main/java/fr/ymanvieu/trading/common/provider/rate/yahoo/YahooStockProvider.java
focal_class.identifier: YahooStockProvider
focal_class.interfaces: implements LatestRateProvider, HistoricalRateProvider
focal_class.class_method_signature: YahooStockProvider.getRates()
focal_class.full_signature: @Override public List<Quote> getRates()
focal_class.identifier: getRates
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: List<Quote>
focal_class.signature: List<Quote> getRates()
focal_class.class_method_signature: YahooStockProvider.toInstant(long secondsTimestamp)
focal_class.full_signature: private static Instant toInstant(long secondsTimestamp)
focal_class.identifier: toInstant
focal_class.modifiers: private static
focal_class.parameters: (long secondsTimestamp)
focal_class.return: Instant
focal_class.signature: Instant toInstant(long secondsTimestamp)
focal_class.class_method_signature: YahooStockProvider.getLatestRate(String symbol)
focal_class.full_signature: @Override public Quote getLatestRate(String symbol)
focal_class.identifier: getLatestRate
focal_class.modifiers: @Override public
focal_class.parameters: (String symbol)
focal_class.return: Quote
focal_class.signature: Quote getLatestRate(String symbol)
focal_class.class_method_signature: YahooStockProvider.getHistoricalRates()
focal_class.full_signature: @Override public List<Quote> getHistoricalRates()
focal_class.identifier: getHistoricalRates
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: List<Quote>
focal_class.signature: List<Quote> getHistoricalRates()
focal_class.class_method_signature: YahooStockProvider.getHistoricalRates(String code)
focal_class.full_signature: @Override public List<Quote> getHistoricalRates(String code)
focal_class.identifier: getHistoricalRates
focal_class.modifiers: @Override public
focal_class.parameters: (String code)
focal_class.return: List<Quote>
focal_class.signature: List<Quote> getHistoricalRates(String code)
focal_class.class_method_signature: YahooStockProvider.getCurrency(List<Pair> symbols, String symbol)
focal_class.full_signature: private String getCurrency(List<Pair> symbols, String symbol)
focal_class.identifier: getCurrency
focal_class.modifiers: private
focal_class.parameters: (List<Pair> symbols, String symbol)
focal_class.return: String
focal_class.signature: String getCurrency(List<Pair> symbols, String symbol)
focal_class.class_method_signature: YahooStockProvider.getSource(List<Pair> symbols, String symbol)
focal_class.full_signature: private String getSource(List<Pair> symbols, String symbol)
focal_class.identifier: getSource
focal_class.modifiers: private
focal_class.parameters: (List<Pair> symbols, String symbol)
focal_class.return: String
focal_class.signature: String getSource(List<Pair> symbols, String symbol)
focal_class.class_method_signature: YahooStockProvider.createPairsString(List<Pair> symbols)
focal_class.full_signature: private String createPairsString(List<Pair> symbols)
focal_class.identifier: createPairsString
focal_class.modifiers: private
focal_class.parameters: (List<Pair> symbols)
focal_class.return: String
focal_class.signature: String createPairsString(List<Pair> symbols)
focal_method.body: @Override
  	public List<Quote> getRates() throws IOException {
  		List<Quote> rates = new ArrayList<>();
  
  		List<Pair> symbols = pairService.getAllFromProvider("YAHOO");
  
  		if (symbols.isEmpty()) {
  			log.trace("symbols list is empty");
  			return rates;
  		}
  
  		YahooModel result = rt.getForObject(format(url, createPairsString(symbols)), YahooModel.class);
  
  		return result.getQuoteResponse().getResult().stream()
  				.map(yf -> new Quote(getSource(symbols, yf.getSymbol()), getCurrency(symbols, yf.getSymbol()),
  						BigDecimal.valueOf(yf.getRegularMarketPrice()), toInstant(yf.getRegularMarketTime())))
  				.collect(Collectors.toList());
  	}
focal_method.class_method_signature: YahooStockProvider.getRates()
focal_method.full_signature: @Override public List<Quote> getRates()
focal_method.identifier: getRates
focal_method.invocations: getAllFromProvider isEmpty trace getForObject format createPairsString collect map stream getResult getQuoteResponse getSource getSymbol getCurrency getSymbol valueOf getRegularMarketPrice toInstant getRegularMarketTime toList
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: List<Quote>
focal_method.signature: List<Quote> getRates()