Skip to content

Commit

Permalink
Fix checkstyle violations. Ready to release 1.4.13
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanenicolas committed Aug 3, 2014
1 parent 7f257d8 commit 8f85353
Showing 1 changed file with 39 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,44 @@

public class SpiceListViewTest extends InstrumentationTestCase {

private SpiceListView spiceListView;
private OnScrollListener mockOnScrollListener;

@Override
protected void setUp() throws Exception {
super.setUp();
spiceListView = new SpiceListView(getInstrumentation().getContext());
mockOnScrollListener = EasyMock.createMock(OnScrollListener.class);
}

@UiThreadTest
public void testOnScroll_triggers_wrapped_listener() {
//GIVEN
mockOnScrollListener.onScroll(spiceListView, 0,0,0);
EasyMock.replay(mockOnScrollListener);

//WHEN
spiceListView.setOnScrollListener(mockOnScrollListener);
spiceListView.scrollTo(0, 100);

//THEN
EasyMock.verify(mockOnScrollListener);
}

@UiThreadTest
public void testOnFling_triggers_wrapped_listener() throws InterruptedException {
//GIVEN
mockOnScrollListener.onScroll(spiceListView, 0,0,0);
mockOnScrollListener.onScrollStateChanged(spiceListView, OnScrollListener.SCROLL_STATE_FLING);
EasyMock.replay(mockOnScrollListener);

//WHEN
spiceListView.setOnScrollListener(mockOnScrollListener);
spiceListView.onScrollListener.onScrollStateChanged(spiceListView, OnScrollListener.SCROLL_STATE_FLING);

//THEN
EasyMock.verify(mockOnScrollListener);
}
private static final int SCROLL_Y_AMOUNT_IN_PIXELS = 100;
private SpiceListView spiceListView;
private OnScrollListener mockOnScrollListener;

@Override
protected void setUp() throws Exception {
super.setUp();
spiceListView = new SpiceListView(getInstrumentation().getContext());
mockOnScrollListener = EasyMock.createMock(OnScrollListener.class);
}

@UiThreadTest
public void testOnScroll_triggers_wrapped_listener() {
//GIVEN
mockOnScrollListener.onScroll(spiceListView, 0, 0, 0);
EasyMock.replay(mockOnScrollListener);

//WHEN
spiceListView.setOnScrollListener(mockOnScrollListener);
spiceListView.scrollTo(0, SCROLL_Y_AMOUNT_IN_PIXELS);

//THEN
EasyMock.verify(mockOnScrollListener);
}

@UiThreadTest
public void testOnFling_triggers_wrapped_listener() throws InterruptedException {
//GIVEN
mockOnScrollListener.onScroll(spiceListView, 0, 0, 0);
mockOnScrollListener.onScrollStateChanged(spiceListView, OnScrollListener.SCROLL_STATE_FLING);
EasyMock.replay(mockOnScrollListener);

//WHEN
spiceListView.setOnScrollListener(mockOnScrollListener);
spiceListView.onScrollListener.onScrollStateChanged(spiceListView, OnScrollListener.SCROLL_STATE_FLING);

//THEN
EasyMock.verify(mockOnScrollListener);
}

}

0 comments on commit 8f85353

Please sign in to comment.