コード例 #1
0
  @Test
  public void testOnSeekBarMovedChangesCOlor() {
    presenter.mBtService = service;
    presenter.onSeekBarMove(50, 100, 255);

    verify(service, times(1)).changeColor(colorCaptor.capture(), handlerCaptor.capture());
    assertPlutoColorEqual(50, 100, 255, colorCaptor.getValue());
  }
コード例 #2
0
  @Test
  public void testBleResultHandlerError() {
    presenter.mBtService = service;
    doReturn("app").when(service).getString(R.string.app_name);
    doReturn("read_error").when(service).getString(R.string.read_color_error);
    presenter.mReadColorHandler.onError();

    verify(baseView, times(1)).popUp("app", "read_error");
  }
コード例 #3
0
  @Test
  public void testOnSeekBarMovedOnSuccess() {
    presenter.mBtService = service;
    presenter.onSeekBarMove(50, 100, 255);
    verify(service, times(1)).changeColor(any(PlutoColor.class), handlerCaptor.capture());
    handlerCaptor.getValue().onSuccess();

    verify(view, times(1)).setBackgroundColor(colorCaptor.capture());
    assertPlutoColorEqual(50, 100, 255, colorCaptor.getValue());
  }
コード例 #4
0
  @Test
  public void testOnSeekBarMovedOnError() {
    doReturn("app").when(service).getString(R.string.app_name);
    doReturn("write_error").when(service).getString(R.string.change_color_error);
    presenter.mBtService = service;
    presenter.onSeekBarMove(50, 100, 255);
    verify(service, times(1)).changeColor(any(PlutoColor.class), handlerCaptor.capture());
    handlerCaptor.getValue().onError();

    verify(baseView, times(1)).popUp("app", "write_error");
  }