@SuppressWarnings("unchecked") @Test public void testSelectImport_shouldSelectImport() throws Exception { tester.clickLink("tree:i:1:nodeComponent:contentLink", true); TextField<String> importName = (TextField<String>) tester.getComponentFromLastRenderedPage("editForm:importName"); assertTrue(importName.isEnabled()); assertEquals("aaaa.bbbb.ccc", importName.getModelObject()); }
@Test @SuppressWarnings("unchecked") public void testRenderNew() { PageParameters pageParameters = new PageParameters(); tester.startPage(EditProductPage.class, pageParameters); tester.assertRenderedPage(EditProductPage.class); tester.assertNoErrorMessage(); tester.assertComponent("productPanel:feedback", FeedbackPanel.class); tester.assertComponent("productPanel:productForm", Form.class); tester.assertComponent("productPanel:productForm:control.uuid:uuid", TextField.class); final TextField<String> uuidField = (TextField<String>) tester.getComponentFromLastRenderedPage("productPanel:productForm:control.uuid:uuid"); assertTrue(uuidField.isEnabled(), "uuid should be enabled when creating a new product"); }
@Test @SuppressWarnings("unchecked") public void testRenderEdit() { PageParameters pageParameters = new PageParameters(); pageParameters.set(CURRENT_UUID.toString(), shsProduct.getUuid()); pageParameters.set(EDIT_MODE.toString(), true); tester.startPage(EditProductPage.class, pageParameters); tester.assertRenderedPage(EditProductPage.class); tester.assertNoErrorMessage(); tester.assertComponent("productPanel:feedback", FeedbackPanel.class); tester.assertComponent("productPanel:productForm", Form.class); tester.assertComponent("productPanel:productForm:control.uuid:uuid", TextField.class); final TextField<String> uuidField = (TextField<String>) tester.getComponentFromLastRenderedPage("productPanel:productForm:control.uuid:uuid"); assertEquals(uuidField.getModelObject(), shsProduct.getUuid()); assertFalse(uuidField.isEnabled(), "uuid was not disabled when editing an existing product"); }