Skip to content

Commit

Permalink
Small test code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
techyourchance committed Jun 12, 2019
1 parent 5a45218 commit 2b503c1
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class FetchDataUseCaseTest {

private static final String TEST_DATA = "testData";

private ThreadPostersTestDouble mThreadPostersTestDouble = new ThreadPostersTestDouble();
private ThreadPostersTestDouble mThreadPostersTestDouble;

private FakeDataFetcher mFakeDataFetcherMock;
private FetchDataUseCase.Listener mListener1;
Expand All @@ -30,6 +30,7 @@ public class FetchDataUseCaseTest {
@Before
public void setup() throws Exception {
mFakeDataFetcherMock = mock(FakeDataFetcher.class);
mThreadPostersTestDouble = new ThreadPostersTestDouble();

SUT = new FetchDataUseCase(
mFakeDataFetcherMock,
Expand Down Expand Up @@ -59,7 +60,6 @@ public void fetchData_successNoListeners_completesWithoutErrors() throws Excepti
public void fetchData_successMultipleListeners_notifiedWithCorrectData() throws Exception {
// Arrange
success();
ArgumentCaptor<String> ac = ArgumentCaptor.forClass(String.class);
// Act
SUT.registerListener(mListener1);
SUT.registerListener(mListener2);
Expand All @@ -70,11 +70,8 @@ public void fetchData_successMultipleListeners_notifiedWithCorrectData() throws
// all side effects to be present
mThreadPostersTestDouble.join();

verify(mListener1).onDataFetched(ac.capture());
verify(mListener2).onDataFetched(ac.capture());
List<String> dataList = ac.getAllValues();
assertThat(dataList.get(0), is(TEST_DATA));
assertThat(dataList.get(1), is(TEST_DATA));
verify(mListener1).onDataFetched(TEST_DATA);
verify(mListener2).onDataFetched(TEST_DATA);
}

@Test
Expand Down

0 comments on commit 2b503c1

Please sign in to comment.