Skip to content

Commit

Permalink
Increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
hamza-vd committed Dec 14, 2020
1 parent 45af3ff commit 65b5bdd
Showing 1 changed file with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package org.smartregister.chw.core.fragment;


import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.robolectric.util.ReflectionHelpers;
import org.smartregister.chw.core.BaseUnitTest;
import org.smartregister.chw.core.R;
import org.smartregister.chw.core.presenter.CoreAllClientsRegisterFragmentPresenter;

public class CoreAllClientsRegisterFragmentTest extends BaseUnitTest {


@Mock
private CoreAllClientsRegisterFragmentPresenter presenter;

private CoreAllClientsRegisterFragment fragment;

@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
fragment = Mockito.mock(CoreAllClientsRegisterFragment.class, Mockito.CALLS_REAL_METHODS);
ReflectionHelpers.setField(fragment, "presenter", presenter);
}

@Test
public void presenterInitializesCorrectly() {
fragment.initializePresenter();
Assert.assertNotNull(presenter);
}

@Test
public void testGetToolbarTitle() {
int title = fragment.getToolBarTitle();
Assert.assertEquals(R.string.menu_all_clients, title);
}
}

0 comments on commit 65b5bdd

Please sign in to comment.