test_class.declarator: dateFormat = new SimpleDateFormat("yyyy-MM-d")
test_class.modifier: private static
test_class.original_string: private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-d");
test_class.type: SimpleDateFormat
test_class.var_name: dateFormat
test_class.file: app/src/test/java/com/romainpiel/bitcointracker/network/BPIServiceClientTest.java
test_class.identifier: BPIServiceClientTest
test_case.body: @Test
      public void getHistory_oneNext() throws ParseException {
          BPIService service = mock(BPIService.class);
          when(service.getHistory()).thenReturn(Observable.from(new HistoryDto[] {
                  newHistory(3)
          }));
          BPIServiceClient client = new BPIServiceClient(service);
  
          TestSubscriber<List<BPI>> subscriber = new TestSubscriber<>();
          client.getHistory().subscribe(subscriber);
  
          List<List<BPI>> expectedResults = new ArrayList<>();
          expectedResults.add(Lists.newArrayList(
                  new BPI(newDate(3), 3f, 1f/2f),
                  new BPI(newDate(2), 2f, 1f)
          ));
          subscriber.assertReceivedOnNext(expectedResults);
          subscriber.assertTerminalEvent();
          subscriber.assertNoErrors();
      }
test_case.class_method_signature: BPIServiceClientTest.getHistory_oneNext()
test_case.full_signature: @Test public void getHistory_oneNext()
test_case.identifier: getHistory_oneNext
test_case.invocations: mock thenReturn when getHistory from newHistory subscribe getHistory add newArrayList newDate newDate assertReceivedOnNext assertTerminalEvent assertNoErrors
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void getHistory_oneNext()
focal_class.declarator: bpiService
focal_class.modifier: private
focal_class.original_string: private BPIService bpiService;
focal_class.type: BPIService
focal_class.var_name: bpiService
focal_class.file: app/src/main/java/com/romainpiel/bitcointracker/network/BPIServiceClient.java
focal_class.identifier: BPIServiceClient
focal_class.class_method_signature: BPIServiceClient.BPIServiceClient(BPIService bpiService)
focal_class.full_signature: public  BPIServiceClient(BPIService bpiService)
focal_class.identifier: BPIServiceClient
focal_class.modifiers: public
focal_class.parameters: (BPIService bpiService)
focal_class.signature:  BPIServiceClient(BPIService bpiService)
focal_class.class_method_signature: BPIServiceClient.getCurrentUSDPrice()
focal_class.full_signature: public Observable<BPI> getCurrentUSDPrice()
focal_class.identifier: getCurrentUSDPrice
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Observable<BPI>
focal_class.signature: Observable<BPI> getCurrentUSDPrice()
focal_class.class_method_signature: BPIServiceClient.getHistory()
focal_class.full_signature: public Observable<List<BPI>> getHistory()
focal_class.identifier: getHistory
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Observable<List<BPI>>
focal_class.signature: Observable<List<BPI>> getHistory()
focal_method.body: public Observable<List<BPI>> getHistory() {
          return bpiService.getHistory().flatMap(new Func1<HistoryDto, Observable<List<BPI>>>() {
              @Override
              public Observable<List<BPI>> call(HistoryDto historyDto) {
                  return Observable.from(historyDto.getBpi().entrySet())
                          .map(new Func1<Map.Entry<Date, Float>, BPI>() {
                              @Override
                              public BPI call(Map.Entry<Date, Float> entry) {
                                  return new BPI(entry.getKey(), entry.getValue());
                              }
                          })
                          .scan(new Func2<BPI, BPI, BPI>() {
                              @Override
                              public BPI call(BPI bpi, BPI bpi2) {
                                  if (bpi.getClose() != 0) {
                                      bpi2.setChange(bpi);
                                  }
                                  return bpi2;
                              }
                          })
                          .filter(new Func1<BPI, Boolean>() {
                              @Override
                              public Boolean call(BPI bpi) {
                                  return bpi.getChange() != null;
                              }
                          })
                          .toSortedList(new Func2<BPI, BPI, Integer>() {
                              @Override
                              public Integer call(BPI bpi, BPI bpi2) {
                                  // DESC order
                                  return - bpi.getDate().compareTo(bpi2.getDate());
                              }
                          });
              }
          });
      }
focal_method.class_method_signature: BPIServiceClient.getHistory()
focal_method.full_signature: public Observable<List<BPI>> getHistory()
focal_method.identifier: getHistory
focal_method.invocations: flatMap getHistory toSortedList filter scan map from entrySet getBpi getKey getValue getClose setChange getChange compareTo getDate getDate
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: Observable<List<BPI>>
focal_method.signature: Observable<List<BPI>> getHistory()