}
@Test
public void testNewEnumFieldWithType() throws Exception
{
JavaResource entity = projectHelper.createJPAEntity(project, "Customer");
JavaResource enumEntity = projectHelper.createEmptyEnum(project, "CustomerType");
try (WizardCommandController controller = uiTestHarness.createWizardController(NewFieldWizard.class,
project.getRoot()))
{
controller.initialize();
Assert.assertTrue(controller.isEnabled());
controller.setValueFor("targetEntity", entity);
Assert.assertFalse(controller.canExecute());
controller.setValueFor("named", "customerType");
controller.setValueFor("type", enumEntity.getJavaType().getCanonicalName());
controller.setValueFor("enumType", EnumType.STRING);
Assert.assertFalse(controller.canMoveToNextStep());
Assert.assertTrue(controller.canExecute());
Result result = controller.execute();
Assert.assertFalse(result instanceof Failed);