AddNewValueDialog extends SimpleModalDialog { public TextField getValueField() { return valueField; } AddNewValueDialog(EntityModel<T> entityModel, AttributeModel attributeModel, BaseService<ID, T> service,
            MessageService messageService); TextField getValueField();  }
@Test public void testCreateSuccesfully() { afterEntity = false; EntityModel<TestEntity> parent = factory.getModel(TestEntity.class); EntityModel<TestDomain> em = factory.getModel(TestDomain.class); AddNewValueDialog<Integer, TestDomain> dialog = new AddNewValueDialog<Integer, TestDomain>(em, parent.getAttributeModel("testDomain"), baseService, messageService) { private static final long serialVersionUID = -7549550521712714056L; @Override protected void afterNewEntityAdded(TestDomain entity) { afterEntity = true; } }; dialog.build(); dialog.open(); dialog.getValueField().setValue("value"); dialog.getOkButton().click(); assertTrue(afterEntity); }