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 May 28, 2021
1 parent 987b959 commit a991728
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,25 @@ public void testGetCustomTranslatableWidgetFields() {
Assert.assertEquals(1, editableProperties.size());
Assert.assertEquals("options.text", editableProperties.iterator().next());
}


@Test
public void testPerformValidation() throws Exception {
Assert.assertNotNull(factory);
CheckBoxFactory factorySpy = Mockito.spy(factory);
Assert.assertNotNull(rootLayout);
LinearLayout rootLayoutSpy = Mockito.spy(rootLayout);

LinearLayout checkboxOptionLayout = Mockito.mock(LinearLayout.class);
CheckBox currentCheckbox = Mockito.mock(CheckBox.class);

Mockito.doReturn(2).when(rootLayoutSpy).getChildCount();
Mockito.doReturn(checkboxOptionLayout).when(rootLayoutSpy).getChildAt(Mockito.anyInt());
Mockito.doReturn(currentCheckbox).when(checkboxOptionLayout).getChildAt(0);
Mockito.doReturn(true).when(currentCheckbox).isChecked();

Boolean checked = Whitebox.invokeMethod(factorySpy, "performValidation", rootLayoutSpy);

Assert.assertTrue(checked);
}
}

0 comments on commit a991728

Please sign in to comment.