@Test
public void testNewFieldWithNotNullableInsertableUpdatableFalse() throws Exception
{
JavaResource entity = projectHelper.createJPAEntity(project, "Customer");
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", "firstName");
controller.setValueFor("columnName", "FIRST_NAME_COLUMN");
controller.setValueFor("not-nullable", "false");
controller.setValueFor("not-insertable", "false");
controller.setValueFor("not-updatable", "false");
Assert.assertFalse(controller.canMoveToNextStep());
Assert.assertTrue(controller.canExecute());
Result result = controller.execute();
Assert.assertFalse(result instanceof Failed);
Assert.assertEquals("Field firstName created", result.getMessage());
}
JavaClass<?> javaClass = entity.getJavaType();
Assert.assertTrue(javaClass.hasField("firstName"));
final Field<?> field = javaClass.getField("firstName");
Assert.assertTrue(field.hasAnnotation(Column.class));
Assert.assertEquals("String", field.getType().getName());
Assert.assertEquals("FIRST_NAME_COLUMN", field.getAnnotation(Column.class).getStringValue("name"));