LynxView extends RelativeLayout implements LynxPresenter.View { @Override public void showTraces(List<Trace> traces, int removedTraces) { if (lastScrollPosition == 0) { lastScrollPosition = lv_traces.getFirstVisiblePosition(); } adapter.clear(); adapter.addAll(traces); adapter.notifyDataSetChanged(); updateScrollPosition(removedTraces); } 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 shouldShowTracesPassedAsParameter() { int numberOfTracesToShow = 10; List<Trace> traces = givenAnyListOfTraces(numberOfTracesToShow); lynxView.showTraces(traces, 0); ListView tracesListView = getLvTraces(); int tracesCount = tracesListView.getAdapter().getCount(); assertEquals(numberOfTracesToShow, tracesCount); assertTracesRendered(traces, tracesListView); }
@Test public void shouldReplaceOldTracesAndUseTheNewOne() { List<Trace> traces = givenAnyListOfTraces(10); List<Trace> newTraces = givenAnyListOfTraces(20); lynxView.showTraces(traces, 0); lynxView.showTraces(newTraces, 0); ListView tracesListView = getLvTraces(); int tracesCount = tracesListView.getAdapter().getCount(); assertEquals(20, tracesCount); assertTracesRendered(newTraces, tracesListView); }