Skip to content

Commit

Permalink
fix codacy issue
Browse files Browse the repository at this point in the history
  • Loading branch information
bennsimon committed Oct 27, 2020
1 parent 9c0e906 commit 57a2c65
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
import org.powermock.reflect.Whitebox;
Expand Down Expand Up @@ -547,12 +546,12 @@ public void testShowInformationDialogShouldShowCustomDialog() {
view.setTag(R.id.label_dialog_title, "title");
view.setTag(R.id.label_dialog_info, "info");

JsonFormFragmentPresenter spyPresenter = Mockito.spy(presenter);
Dialog dialogSpy = Mockito.spy(new Dialog(view.getContext()));
Mockito.doReturn(dialogSpy).when(spyPresenter).getCustomDialog(view);
JsonFormFragmentPresenter spyPresenter = spy(presenter);
Dialog dialogSpy = spy(new Dialog(view.getContext()));
doReturn(dialogSpy).when(spyPresenter).getCustomDialog(view);
spyPresenter.showInformationDialog(view);

verify(dialogSpy, Mockito.times(1)).show();
verify(dialogSpy, times(1)).show();

assertTrue(dialogSpy.findViewById(R.id.dialogText).isShown());

Expand All @@ -562,7 +561,7 @@ public void testShowInformationDialogShouldShowCustomDialog() {

dialogSpy.findViewById(R.id.dialogButton).performClick();

verify(dialogSpy, Mockito.times(1)).dismiss();
verify(dialogSpy, times(1)).dismiss();
}

@Test
Expand All @@ -571,15 +570,15 @@ public void testShowInformationDialogShouldShowAlertDialog() {
view.setTag(R.id.label_dialog_title, "title");
view.setTag(R.id.label_dialog_info, "info");

JsonFormFragmentPresenter spyPresenter = Mockito.spy(presenter);
JsonFormFragmentPresenter spyPresenter = spy(presenter);

AlertDialog.Builder spyBuilder = Mockito.spy(new AlertDialog.Builder(view.getContext(),
AlertDialog.Builder spyBuilder = spy(new AlertDialog.Builder(view.getContext(),
R.style.AppThemeAlertDialog));

Mockito.doReturn(spyBuilder).when(spyPresenter).getAlertDialogBuilder();
doReturn(spyBuilder).when(spyPresenter).getAlertDialogBuilder();

spyPresenter.showInformationDialog(view);

verify(spyBuilder, Mockito.times(1)).show();
verify(spyBuilder, times(1)).show();
}
}

0 comments on commit 57a2c65

Please sign in to comment.