@Test public void testGenerateHiddenAndRequiredProperty() throws Exception { Map<String, Object> root = createInspectionResultWrapper(ENTITY_NAME, ENTITY_ID_PROP); Resource<URL> templateResource = resourceFactory.create( getClass().getResource(Deployments.BASE_PACKAGE_PATH + Deployments.SEARCH_FORM_INPUT)); TemplateProcessor processor = processorFactory.fromTemplate(new FreemarkerTemplate(templateResource)); String output = processor.process(root); assertThat(output.trim(), IsEqual.equalTo("")); }
@Test public void testGenerateManyToOneProperty() throws Exception { Map<String, Object> root = TestHelpers.createInspectionResultWrapper(ENTITY_NAME, MANY_TO_ONE_PROP); Resource<URL> templateResource = resourceFactory.create( getClass().getResource(Deployments.BASE_PACKAGE_PATH + Deployments.SEARCH_FORM_INPUT)); TemplateProcessor processor = processorFactory.fromTemplate(new FreemarkerTemplate(templateResource)); String output = processor.process(root); Document html = Jsoup.parseBodyFragment(output); assertThat(output.trim(), not(equalTo(""))); Elements container = html.select("div.form-group"); assertThat(container, notNullValue()); Elements formInputElement = container.select("div.col-sm-10 > select"); assertThat(formInputElement.attr("id"), equalTo("customer")); assertThat(formInputElement.attr("ng-model"), equalTo("search" + "." + "customer")); }