@@ -0,0 +1,2269 @@
+package com.vishnus1224.teamworkapidemo.datastore;%0A%0Aimport com.vishnus1224.rxjavateamworkclient.client.LatestActivityApiClient;%0Aimport com.vishnus1224.rxjavateamworkclient.model.LatestActivityResponse;%0Aimport com.vishnus1224.rxjavateamworkclient.model.LatestActivityResponseWrapper;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.mockito.Mock;%0Aimport org.mockito.MockitoAnnotations;%0A%0Aimport java.net.UnknownHostException;%0Aimport java.util.List;%0A%0Aimport rx.Observable;%0Aimport rx.observers.TestSubscriber;%0A%0Aimport static org.junit.Assert.*;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.when;%0A%0A/**%0A * Created by vishnu on 07/09/16.%0A */%0Apublic class LatestActivityCloudDataStoreTest %7B%0A%0A    @Mock%0A    private LatestActivityApiClient latestActivityApiClient;%0A%0A    private LatestActivityCloudDataStore latestActivityCloudDataStore;%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A%0A        MockitoAnnotations.initMocks(this);%0A%0A        latestActivityCloudDataStore = new LatestActivityCloudDataStore(latestActivityApiClient);%0A%0A    %7D%0A%0A    @Test%0A    public void testGetAllItems() throws Exception %7B%0A%0A        when(latestActivityApiClient.getLatestActivity()).thenReturn(Observable.%3CLatestActivityResponseWrapper%3Eempty());%0A%0A        Observable%3CList%3CLatestActivityResponse%3E%3E observable = latestActivityCloudDataStore.getAllItems();%0A%0A        TestSubscriber testSubscriber = new TestSubscriber();%0A%0A        observable.subscribe(testSubscriber);%0A%0A        testSubscriber.assertCompleted();%0A        testSubscriber.assertNoErrors();%0A%0A        verify(latestActivityApiClient).getLatestActivity();%0A%0A%0A    %7D%0A%0A    @Test%0A    public void testGetAllItemsThrowsUnknownHostException() throws Exception %7B%0A%0A        when(latestActivityApiClient.getLatestActivity()).thenReturn(Observable.%3CLatestActivityResponseWrapper%3Eerror(new UnknownHostException()));%0A%0A        Observable%3CList%3CLatestActivityResponse%3E%3E observable = latestActivityCloudDataStore.getAllItems();%0A%0A        TestSubscriber testSubscriber = new TestSubscriber();%0A%0A        observable.subscribe(testSubscriber);%0A%0A        testSubscriber.assertError(UnknownHostException.class);%0A        testSubscriber.assertTerminalEvent();%0A%0A        verify(latestActivityApiClient).getLatestActivity();%0A%0A    %7D%0A%7D

test for the latest activity cloud data store