Skip to content

Commit

Permalink
updated test
Browse files Browse the repository at this point in the history
  • Loading branch information
junaidwarsivd committed May 29, 2023
1 parent 113dcf3 commit 949c667
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.smartregister.BaseUnitTest;
import org.smartregister.domain.Response;
import org.smartregister.domain.ResponseStatus;
Expand All @@ -24,6 +23,8 @@
import java.util.Arrays;
import java.util.List;

import static org.junit.Assert.assertTrue;

public class DrishtiServiceTest extends BaseUnitTest {
@Mock
private HTTPAgent httpAgent;
Expand Down Expand Up @@ -69,7 +70,7 @@ public void shouldFetchNoAlertActionsWhenJsonIsForEmptyList() throws Exception {

Response<List<Action>> actions = drishtiService.fetchNewActions("anm1", "0");

Assert.assertTrue(actions.payload().isEmpty());
assertTrue(actions.payload().isEmpty());
}

@Test
Expand All @@ -78,7 +79,7 @@ public void shouldFetchNoAlertActionsWhenHTTPCallFails() throws Exception {

Response<List<Action>> actions = drishtiService.fetchNewActions("anm1", "0");

Assert.assertTrue(actions.payload().isEmpty());
assertTrue(actions.payload().isEmpty());
Assert.assertEquals(ResponseStatus.failure, actions.status());
}

Expand All @@ -102,7 +103,7 @@ public void shouldReturnFailureResponseWhenJsonIsMalformed() {

Response<List<Action>> actions = drishtiService.fetchNewActions("anm1", "0");

Assert.assertTrue(actions.payload().isEmpty());
assertTrue(actions.payload().isEmpty());
Assert.assertEquals(ResponseStatus.failure, actions.status());
}

Expand All @@ -116,5 +117,6 @@ public void testStartOnlyIfConnectedToNetwork() {
.thenReturn(connectivityManager);
Mockito.when(connectivityManager.getActiveNetworkInfo()).thenReturn(networkInfo);
DrishtiSyncScheduler.startOnlyIfConnectedToNetwork(context);
assertTrue(networkInfo.isConnected());
}
}

0 comments on commit 949c667

Please sign in to comment.