LynxView extends RelativeLayout implements LynxPresenter.View { public void setLynxConfig(LynxConfig lynxConfig) { validateLynxConfig(lynxConfig); boolean hasChangedLynxConfig = !this.lynxConfig.equals(lynxConfig); if (hasChangedLynxConfig) { this.lynxConfig = (LynxConfig) lynxConfig.clone(); updateFilterText(); updateAdapter(); updateSpinner(); presenter.setLynxConfig(lynxConfig); } } LynxView(Context context);  LynxView(Context context, AttributeSet attrs);  LynxView(Context context, AttributeSet attrs, int defStyleAttr); void setLynxConfig(LynxConfig lynxConfig); LynxConfig getLynxConfig(); @Override void showTraces(List<Trace> traces, int removedTraces); @Override void clear(); @CheckResult @Override boolean shareTraces(String fullTraces); @Override void notifyShareTracesFailed(); @Override void disableAutoScroll(); @Override void enableAutoScroll();  }
@Test public void shouldApplyNewConfigJustIfIsDifferentOfTheCurrentOne() { LynxConfig newLynxConfig = new LynxConfig().setTextSizeInPx(ANY_TEXT_SIZE); lynxView.setLynxConfig(newLynxConfig); verify(presenter).setLynxConfig(newLynxConfig); }
@Test public void shouldNotApplyNewConfigIfIsEqualsToThePreviousOne() { LynxConfig defaultConfig = new LynxConfig(); lynxView.setLynxConfig(defaultConfig); verify(presenter, never()).setLynxConfig(defaultConfig); }
@Test public void shouldChangeSpinnerItemOnConfigChanges() { LynxConfig newLynxConfig = new LynxConfig().setFilterTraceLevel(TraceLevel.WTF); lynxView.setLynxConfig(newLynxConfig); Spinner spinner = getTraceLevelFilterSpinner(); assertEquals(TraceLevel.WTF, spinner.getSelectedItem()); }