@Test public void shouldBuildAWarningDialogGivenADelegateAndMessages(){ WarningDialogFragmentBuilder warningDialogFragmentBuilder = new WarningDialogFragmentBuilder(); WarningDialogFragment.DialogDelegate delegate = new WarningDialogFragment.DialogDelegate() { @Override public void onPositiveClick() { } }; int titleMessage = 2; int positiveButtonMessage = 3; int negativeButtonMessage = 4; WarningDialogFragment warningDialogFragment = warningDialogFragmentBuilder.build(delegate, titleMessage, positiveButtonMessage, negativeButtonMessage); assertThat((Integer) warningDialogFragment.getArguments().get("messageResId"), is(titleMessage)); assertThat((Integer) warningDialogFragment.getArguments().get("positiveTextResId"), is(positiveButtonMessage)); assertThat((Integer) warningDialogFragment.getArguments().get("negativeTextResId"), is(negativeButtonMessage)); }
public WarningDialogFragment build(WarningDialogFragment.DialogDelegate delegate, int message, int positiveMessageButton, int negativeMessageButton) { WarningDialogFragment wipeDataDialog = WarningDialogFragment.newInstance( message, positiveMessageButton, negativeMessageButton); wipeDataDialog.setDelegate(delegate); return wipeDataDialog; }
WarningDialogFragmentBuilder { public WarningDialogFragment build(WarningDialogFragment.DialogDelegate delegate, int message, int positiveMessageButton, int negativeMessageButton) { WarningDialogFragment wipeDataDialog = WarningDialogFragment.newInstance( message, positiveMessageButton, negativeMessageButton); wipeDataDialog.setDelegate(delegate); return wipeDataDialog; } }
WarningDialogFragmentBuilder { public WarningDialogFragment build(WarningDialogFragment.DialogDelegate delegate, int message, int positiveMessageButton, int negativeMessageButton) { WarningDialogFragment wipeDataDialog = WarningDialogFragment.newInstance( message, positiveMessageButton, negativeMessageButton); wipeDataDialog.setDelegate(delegate); return wipeDataDialog; } @Inject  WarningDialogFragmentBuilder(); }
WarningDialogFragmentBuilder { public WarningDialogFragment build(WarningDialogFragment.DialogDelegate delegate, int message, int positiveMessageButton, int negativeMessageButton) { WarningDialogFragment wipeDataDialog = WarningDialogFragment.newInstance( message, positiveMessageButton, negativeMessageButton); wipeDataDialog.setDelegate(delegate); return wipeDataDialog; } @Inject  WarningDialogFragmentBuilder(); WarningDialogFragment build(WarningDialogFragment.DialogDelegate delegate,
                                       int message, int positiveMessageButton,
                                       int negativeMessageButton); WarningDialogFragment build(WarningDialogFragment.DialogDelegate delegate,
                                       String message, String positiveMessageButton,
                                       String negativeMessageButton); }
WarningDialogFragmentBuilder { public WarningDialogFragment build(WarningDialogFragment.DialogDelegate delegate, int message, int positiveMessageButton, int negativeMessageButton) { WarningDialogFragment wipeDataDialog = WarningDialogFragment.newInstance( message, positiveMessageButton, negativeMessageButton); wipeDataDialog.setDelegate(delegate); return wipeDataDialog; } @Inject  WarningDialogFragmentBuilder(); WarningDialogFragment build(WarningDialogFragment.DialogDelegate delegate,
                                       int message, int positiveMessageButton,
                                       int negativeMessageButton); WarningDialogFragment build(WarningDialogFragment.DialogDelegate delegate,
                                       String message, String positiveMessageButton,
                                       String negativeMessageButton);  }