use of org.springframework.beans.testfixture.beans.TestBean in project spring-framework by spring-projects.
the class FreeMarkerMacroTests method testExposeSpringMacroHelpers.
@Test
public void testExposeSpringMacroHelpers() throws Exception {
FreeMarkerView fv = new FreeMarkerView() {
@Override
@SuppressWarnings("rawtypes")
protected void processTemplate(Template template, SimpleHash fmModel, HttpServletResponse response) throws TemplateException {
Map model = fmModel.toMap();
assertThat(model.get(FreeMarkerView.SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE)).isInstanceOf(RequestContext.class);
RequestContext rc = (RequestContext) model.get(FreeMarkerView.SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE);
BindStatus status = rc.getBindStatus("tb.name");
assertThat(status.getExpression()).isEqualTo("name");
assertThat(status.getValue()).isEqualTo("juergen");
}
};
fv.setUrl(TEMPLATE_FILE);
fv.setApplicationContext(wac);
Map<String, Object> model = new HashMap<>();
model.put("tb", new TestBean("juergen", 99));
fv.render(model, request, response);
}
use of org.springframework.beans.testfixture.beans.TestBean in project spring-framework by spring-projects.
the class TextareaTagTests method createTestBean.
@Override
protected TestBean createTestBean() {
// set up test data
this.rob = new TestBean();
rob.setName("Rob");
rob.setMyFloat(12.34f);
TestBean sally = new TestBean();
sally.setName("Sally");
rob.setSpouse(sally);
return rob;
}
use of org.springframework.beans.testfixture.beans.TestBean in project spring-framework by spring-projects.
the class InputTagTests method createTestBean.
@Override
protected TestBean createTestBean() {
// set up test data
this.rob = new TestBean();
this.rob.setName("Rob");
this.rob.setMyFloat(Float.valueOf(12.34f));
TestBean sally = new TestBean();
sally.setName("Sally");
this.rob.setSpouse(sally);
return this.rob;
}
use of org.springframework.beans.testfixture.beans.TestBean in project spring-framework by spring-projects.
the class LabelTagTests method createTestBean.
@Override
protected TestBean createTestBean() {
TestBean bean = new TestBean();
bean.setSpouse(new TestBean("Hoopy"));
return bean;
}
use of org.springframework.beans.testfixture.beans.TestBean in project spring-framework by spring-projects.
the class SelectTagTests method withInvalidList.
@Test
public void withInvalidList() throws Exception {
this.tag.setPath("country");
this.tag.setItems(new TestBean());
this.tag.setItemValue("isoCode");
assertThatExceptionOfType(JspException.class).as("use a non-Collection typed value as the value of 'items'").isThrownBy(this.tag::doStartTag).withMessageContaining("items").withMessageContaining("org.springframework.beans.testfixture.beans.TestBean");
}
Aggregations