### Question:
PmoBasedDialogFactory { public OkCancelDialog newOkDialog(String title, Object... pmos) { return newOkCancelDialog(title, Handler.NOP_HANDLER, Handler.NOP_HANDLER, ButtonOption.OK_ONLY, pmos); } PmoBasedDialogFactory();  PmoBasedDialogFactory(ValidationService validationService);  PmoBasedDialogFactory(PropertyBehavior... propertyBehavior);  PmoBasedDialogFactory(ValidationService validationService,
            PropertyBehaviorProvider propertyBehaviorProvider); @Deprecated OkCancelDialog newOkCancelDialog(String title, Object pmo, Handler okHandler); OkCancelDialog newOkDialog(String title, Object... pmos); OkCancelDialog newOkCancelDialog(String title, Handler okHandler, Object... pmos); OkCancelDialog newOkCancelDialog(String title, Handler okHandler, Handler cancelHandler, Object... pmos); OkCancelDialog openOkDialog(String title, Object... pmos); @Deprecated OkCancelDialog openOkCancelDialog(String title, Object pmo, Handler okHandler); OkCancelDialog openOkCancelDialog(String title, Handler okHandler, Object... pmos); OkCancelDialog openOkCancelDialog(String title, Handler okHandler, Handler cancelHandler, Object... pmos); @Deprecated static OkCancelDialog open(OkCancelDialog dialog);  }### Answer:
@Test public void testNewOkDialog() { OkCancelDialog dialog = new PmoBasedDialogFactory().newOkDialog("title", new TestPmo()); List<AbstractField<?>> fields = getAllFields(dialog); assertThat(fields, hasSize(1)); assertThat(fields.get(0), is(instanceOf(TextField.class))); assertThat(dialog.getCaption(), is("title")); }
@Test public void testNewOkDialog_noPmo() { OkCancelDialog dialog = new PmoBasedDialogFactory().newOkDialog("title"); assertThat(getAllFields(dialog), hasSize(0)); }
@Test public void testNewOkDialog_MultiplePmos() { OkCancelDialog dialog = new PmoBasedDialogFactory().newOkDialog("title", new TestPmo(), new TestPmo()); List<AbstractField<?>> fields = getAllFields(dialog); assertThat(fields, hasSize(2)); fields.forEach(f -> assertThat(f, is(instanceOf(TextField.class)))); assertThat(dialog.getCaption(), is("title")); }