@Test public void testGenerateManyToManyProperty() throws Exception { Map<String, Object> root = TestHelpers.createInspectionResultWrapper(ENTITY_NAME, MANY_TO_MANY_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")); }