Java Code Examples for org.springframework.tests.sample.beans.GenericBean#setCustomEnum()
The following examples show how to use
org.springframework.tests.sample.beans.GenericBean#setCustomEnum() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OptionTagEnumTests.java From spring-analysis-note with MIT License | 6 votes |
@Test @SuppressWarnings("rawtypes") public void withJavaEnum() throws Exception { GenericBean testBean = new GenericBean(); testBean.setCustomEnum(CustomEnum.VALUE_1); getPageContext().getRequest().setAttribute("testBean", testBean); String selectName = "testBean.customEnum"; getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, new BindStatus(getRequestContext(), selectName, false)); this.tag.setValue("VALUE_1"); int result = this.tag.doStartTag(); assertEquals(BodyTag.EVAL_BODY_BUFFERED, result); result = this.tag.doEndTag(); assertEquals(Tag.EVAL_PAGE, result); String output = getWriter().toString(); assertOptionTagOpened(output); assertOptionTagClosed(output); assertContainsAttribute(output, "value", "VALUE_1"); assertContainsAttribute(output, "selected", "selected"); }
Example 2
Source File: OptionTagEnumTests.java From java-technology-stack with MIT License | 6 votes |
@Test @SuppressWarnings("rawtypes") public void withJavaEnum() throws Exception { GenericBean testBean = new GenericBean(); testBean.setCustomEnum(CustomEnum.VALUE_1); getPageContext().getRequest().setAttribute("testBean", testBean); String selectName = "testBean.customEnum"; getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, new BindStatus(getRequestContext(), selectName, false)); this.tag.setValue("VALUE_1"); int result = this.tag.doStartTag(); assertEquals(BodyTag.EVAL_BODY_BUFFERED, result); result = this.tag.doEndTag(); assertEquals(Tag.EVAL_PAGE, result); String output = getWriter().toString(); assertOptionTagOpened(output); assertOptionTagClosed(output); assertContainsAttribute(output, "value", "VALUE_1"); assertContainsAttribute(output, "selected", "selected"); }
Example 3
Source File: OptionTagEnumTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("rawtypes") public void withJavaEnum() throws Exception { GenericBean testBean = new GenericBean(); testBean.setCustomEnum(CustomEnum.VALUE_1); getPageContext().getRequest().setAttribute("testBean", testBean); String selectName = "testBean.customEnum"; getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, new BindStatus(getRequestContext(), selectName, false)); this.tag.setValue("VALUE_1"); int result = this.tag.doStartTag(); assertEquals(BodyTag.EVAL_BODY_BUFFERED, result); result = this.tag.doEndTag(); assertEquals(Tag.EVAL_PAGE, result); String output = getWriter().toString(); assertOptionTagOpened(output); assertOptionTagClosed(output); assertContainsAttribute(output, "value", "VALUE_1"); assertContainsAttribute(output, "selected", "selected"); }