use of cn.taketoday.web.context.support.ServletContextAttributeExporter in project today-framework by TAKETODAY.
the class ServletContextSupportTests method testServletContextAttributeExporter.
@Test
public void testServletContextAttributeExporter() {
TestBean tb = new TestBean();
Map<String, Object> attributes = new HashMap<>();
attributes.put("attr1", "value1");
attributes.put("attr2", tb);
MockServletContext sc = new MockServletContext();
ServletContextAttributeExporter exporter = new ServletContextAttributeExporter();
exporter.setAttributes(attributes);
exporter.setServletContext(sc);
assertThat(sc.getAttribute("attr1")).isEqualTo("value1");
assertThat(sc.getAttribute("attr2")).isSameAs(tb);
}
use of cn.taketoday.web.context.support.ServletContextAttributeExporter in project today-infrastructure by TAKETODAY.
the class ServletContextSupportTests method testServletContextAttributeExporter.
@Test
public void testServletContextAttributeExporter() {
TestBean tb = new TestBean();
Map<String, Object> attributes = new HashMap<>();
attributes.put("attr1", "value1");
attributes.put("attr2", tb);
MockServletContext sc = new MockServletContext();
ServletContextAttributeExporter exporter = new ServletContextAttributeExporter();
exporter.setAttributes(attributes);
exporter.setServletContext(sc);
assertThat(sc.getAttribute("attr1")).isEqualTo("value1");
assertThat(sc.getAttribute("attr2")).isSameAs(tb);
}
Aggregations