test_class.declarator: rxSchedulersOverrideRule = new RxSchedulersOverrideRule()
test_class.modifier: @Rule public
test_class.original_string: @Rule public RxSchedulersOverrideRule rxSchedulersOverrideRule = new RxSchedulersOverrideRule();
test_class.type: RxSchedulersOverrideRule
test_class.var_name: rxSchedulersOverrideRule
test_class.declarator: rxAwareness
test_class.modifier: @Mock
test_class.original_string: @Mock RxAwareness rxAwareness;
test_class.type: RxAwareness
test_class.var_name: rxAwareness
test_class.declarator: mainView
test_class.modifier: @Mock
test_class.original_string: @Mock MainView mainView;
test_class.type: MainView
test_class.var_name: mainView
test_class.declarator: snapshot
test_class.modifier: @Mock
test_class.original_string: @Mock Snapshot snapshot;
test_class.type: Snapshot
test_class.var_name: snapshot
test_class.declarator: fence
test_class.modifier: @Mock
test_class.original_string: @Mock Fence fence;
test_class.type: Fence
test_class.var_name: fence
test_class.declarator: mainPresenter
test_class.original_string: MainPresenter mainPresenter;
test_class.type: MainPresenter
test_class.var_name: mainPresenter
test_class.file: sample/src/test/java/com/patloew/rxawarenesssample/MainPresenterTest.java
test_class.identifier: MainPresenterTest
test_case.body: @Test
      public void test_HeadphonePluggedIn_WeatherClearStormy() {
          HeadphoneState headphoneState = Mockito.mock(HeadphoneState.class);
          doReturn(HeadphoneState.PLUGGED_IN).when(headphoneState).getState();
          doReturn(Single.just(headphoneState)).when(snapshot).getHeadphoneState();
  
          Weather weather = Mockito.mock(Weather.class);
          doReturn(new int[] {Weather.CONDITION_CLEAR, Weather.CONDITION_STORMY}).when(weather).getConditions();
          doReturn(Single.just(weather)).when(snapshot).getWeather();
  
          doReturn(Observable.empty()).when(fence).listenForStateChanges(Matchers.anyString(), Matchers.any(AwarenessFence.class));
  
          mainPresenter.getAwarenessData();
  
          verify(mainView, times(1)).onHeadphoneStateLoaded(Matchers.eq("Plugged In"));
          verify(mainView, times(1)).onWeatherLoaded(Matchers.eq("Clear, Stormy"));
      }
test_case.class_method_signature: MainPresenterTest.test_HeadphonePluggedIn_WeatherClearStormy()
test_case.full_signature: @Test public void test_HeadphonePluggedIn_WeatherClearStormy()
test_case.identifier: test_HeadphonePluggedIn_WeatherClearStormy
test_case.invocations: mock getState when doReturn getHeadphoneState when doReturn just mock getConditions when doReturn getWeather when doReturn just listenForStateChanges when doReturn empty anyString any getAwarenessData onHeadphoneStateLoaded verify times eq onWeatherLoaded verify times eq
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void test_HeadphonePluggedIn_WeatherClearStormy()
focal_class.declarator: TAG = "MainPresenter"
focal_class.modifier: private static final
focal_class.original_string: private static final String TAG = "MainPresenter";
focal_class.type: String
focal_class.var_name: TAG
focal_class.declarator: subscription = new CompositeSubscription()
focal_class.modifier: private final
focal_class.original_string: private final CompositeSubscription subscription = new CompositeSubscription();
focal_class.type: CompositeSubscription
focal_class.var_name: subscription
focal_class.declarator: rxAwareness
focal_class.modifier: private final
focal_class.original_string: private final RxAwareness rxAwareness;
focal_class.type: RxAwareness
focal_class.var_name: rxAwareness
focal_class.declarator: view
focal_class.modifier: private
focal_class.original_string: private MainView view;
focal_class.type: MainView
focal_class.var_name: view
focal_class.file: sample/src/main/java/com/patloew/rxawarenesssample/MainPresenter.java
focal_class.identifier: MainPresenter
focal_class.class_method_signature: MainPresenter.MainPresenter(RxAwareness rxAwareness)
focal_class.full_signature: public  MainPresenter(RxAwareness rxAwareness)
focal_class.identifier: MainPresenter
focal_class.modifiers: public
focal_class.parameters: (RxAwareness rxAwareness)
focal_class.signature:  MainPresenter(RxAwareness rxAwareness)
focal_class.class_method_signature: MainPresenter.attachView(MainView view)
focal_class.full_signature: public void attachView(MainView view)
focal_class.identifier: attachView
focal_class.modifiers: public
focal_class.parameters: (MainView view)
focal_class.return: void
focal_class.signature: void attachView(MainView view)
focal_class.class_method_signature: MainPresenter.detachView()
focal_class.full_signature: public void detachView()
focal_class.identifier: detachView
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void detachView()
focal_class.class_method_signature: MainPresenter.getAwarenessData()
focal_class.full_signature: public void getAwarenessData()
focal_class.identifier: getAwarenessData
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void getAwarenessData()
focal_class.class_method_signature: MainPresenter.getHeadphoneStateString(int state)
focal_class.full_signature: private String getHeadphoneStateString(int state)
focal_class.identifier: getHeadphoneStateString
focal_class.modifiers: private
focal_class.parameters: (int state)
focal_class.return: String
focal_class.signature: String getHeadphoneStateString(int state)
focal_class.class_method_signature: MainPresenter.getWeatherConditionString(int condition)
focal_class.full_signature: private String getWeatherConditionString(int condition)
focal_class.identifier: getWeatherConditionString
focal_class.modifiers: private
focal_class.parameters: (int condition)
focal_class.return: String
focal_class.signature: String getWeatherConditionString(int condition)
focal_method.body: public void getAwarenessData() {
          subscription.add(
                  rxAwareness.snapshot().getHeadphoneState()
                      .map(headphoneState -> getHeadphoneStateString(headphoneState.getState()))
                      .subscribe(view::onHeadphoneStateLoaded, throwable -> Log.e(TAG, "Error getting headphone state", throwable))
          );
  
          subscription.add(
                  rxAwareness.fence().listenForStateChanges("headphoneState", HeadphoneFence.pluggingIn())
                      .map(FenceState::getCurrentState)
                      .subscribe(currentFenceState -> {
                          view.onHeadphoneStateLoaded(getHeadphoneStateString(currentFenceState == FenceState.TRUE ? HeadphoneState.PLUGGED_IN : HeadphoneState.UNPLUGGED));
                      }, throwable -> Log.e(TAG, "Error getting headphone state changes.", throwable))
          );
  
          subscription.add(
                  rxAwareness.snapshot().getWeather()
                          .flatMapObservable(weather -> Observable.fromEmitter(new IntArrayEmitter(weather.getConditions()), Emitter.BackpressureMode.BUFFER))
                          .map(this::getWeatherConditionString)
                          .reduce((s, s2) -> s+", "+s2)
                          .subscribe(view::onWeatherLoaded, throwable -> Log.e(TAG, "Error getting weather.", throwable))
          );
      }
focal_method.class_method_signature: MainPresenter.getAwarenessData()
focal_method.full_signature: public void getAwarenessData()
focal_method.identifier: getAwarenessData
focal_method.invocations: add subscribe map getHeadphoneState snapshot getHeadphoneStateString getState e add subscribe map listenForStateChanges fence pluggingIn onHeadphoneStateLoaded getHeadphoneStateString e add subscribe reduce map flatMapObservable getWeather snapshot fromEmitter getConditions e
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void getAwarenessData()