org.springframework.tests.sample.beans.CustomEnum Java Examples
The following examples show how to use
org.springframework.tests.sample.beans.CustomEnum.
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: UtilNamespaceHandlerTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void testNestedInCollections() { TestBean bean = (TestBean) this.beanFactory.getBean("nestedCustomTagBean"); List list = bean.getSomeList(); assertEquals(1, list.size()); assertEquals(Integer.MIN_VALUE, list.get(0)); Set set = bean.getSomeSet(); assertEquals(2, set.size()); assertTrue(set.contains(Thread.State.NEW)); assertTrue(set.contains(Thread.State.RUNNABLE)); Map map = bean.getSomeMap(); assertEquals(1, map.size()); assertEquals(CustomEnum.VALUE_1, map.get("min")); TestBean bean2 = (TestBean) this.beanFactory.getBean("nestedCustomTagBean"); assertEquals(list, bean2.getSomeList()); assertEquals(set, bean2.getSomeSet()); assertEquals(map, bean2.getSomeMap()); assertFalse(list == bean2.getSomeList()); assertFalse(set == bean2.getSomeSet()); assertFalse(map == bean2.getSomeMap()); }
Example #2
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 #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"); }
Example #4
Source File: UtilNamespaceHandlerTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void testNestedInCollections() { TestBean bean = (TestBean) this.beanFactory.getBean("nestedCustomTagBean"); List list = bean.getSomeList(); assertEquals(1, list.size()); assertEquals(Integer.MIN_VALUE, list.get(0)); Set set = bean.getSomeSet(); assertEquals(2, set.size()); assertTrue(set.contains(Thread.State.NEW)); assertTrue(set.contains(Thread.State.RUNNABLE)); Map map = bean.getSomeMap(); assertEquals(1, map.size()); assertEquals(CustomEnum.VALUE_1, map.get("min")); TestBean bean2 = (TestBean) this.beanFactory.getBean("nestedCustomTagBean"); assertEquals(list, bean2.getSomeList()); assertEquals(set, bean2.getSomeSet()); assertEquals(map, bean2.getSomeMap()); assertFalse(list == bean2.getSomeList()); assertFalse(set == bean2.getSomeSet()); assertFalse(map == bean2.getSomeMap()); }
Example #5
Source File: UtilNamespaceHandlerTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void testNestedInCollections() { TestBean bean = (TestBean) this.beanFactory.getBean("nestedCustomTagBean"); List list = bean.getSomeList(); assertEquals(1, list.size()); assertEquals(Integer.MIN_VALUE, list.get(0)); Set set = bean.getSomeSet(); assertEquals(2, set.size()); assertTrue(set.contains(Thread.State.NEW)); assertTrue(set.contains(Thread.State.RUNNABLE)); Map map = bean.getSomeMap(); assertEquals(1, map.size()); assertEquals(CustomEnum.VALUE_1, map.get("min")); TestBean bean2 = (TestBean) this.beanFactory.getBean("nestedCustomTagBean"); assertEquals(list, bean2.getSomeList()); assertEquals(set, bean2.getSomeSet()); assertEquals(map, bean2.getSomeMap()); assertFalse(list == bean2.getSomeList()); assertFalse(set == bean2.getSomeSet()); assertFalse(map == bean2.getSomeMap()); }
Example #6
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 #7
Source File: BeanWrapperEnumTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testCustomEnumSetWithGetterSetterMismatch() { GenericBean<?> gb = new GenericBean<>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setPropertyValue("customEnumSetMismatch", new String[] {"VALUE_1", "VALUE_2"}); assertEquals(2, gb.getCustomEnumSet().size()); assertTrue(gb.getCustomEnumSet().contains(CustomEnum.VALUE_1)); assertTrue(gb.getCustomEnumSet().contains(CustomEnum.VALUE_2)); }
Example #8
Source File: BeanWrapperEnumTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testStandardEnumMapWithAutoGrowing() { GenericBean<?> gb = new GenericBean<Object>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setAutoGrowNestedPaths(true); assertNull(gb.getStandardEnumMap()); bw.setPropertyValue("standardEnumMap[VALUE_1]", 1); assertEquals(1, gb.getStandardEnumMap().size()); assertEquals(new Integer(1), gb.getStandardEnumMap().get(CustomEnum.VALUE_1)); }
Example #9
Source File: BeanWrapperEnumTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testStandardEnumSetWithMultipleValues() { GenericBean<?> gb = new GenericBean<>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setConversionService(new DefaultConversionService()); assertNull(gb.getStandardEnumSet()); bw.setPropertyValue("standardEnumSet", new String[] {"VALUE_1", "VALUE_2"}); assertEquals(2, gb.getStandardEnumSet().size()); assertTrue(gb.getStandardEnumSet().contains(CustomEnum.VALUE_1)); assertTrue(gb.getStandardEnumSet().contains(CustomEnum.VALUE_2)); }
Example #10
Source File: BeanWrapperEnumTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testStandardEnumMapWithMultipleValues() { GenericBean<?> gb = new GenericBean<>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setConversionService(new DefaultConversionService()); assertNull(gb.getStandardEnumMap()); Map<String, Integer> map = new LinkedHashMap<>(); map.put("VALUE_1", 1); map.put("VALUE_2", 2); bw.setPropertyValue("standardEnumMap", map); assertEquals(2, gb.getStandardEnumMap().size()); assertEquals(new Integer(1), gb.getStandardEnumMap().get(CustomEnum.VALUE_1)); assertEquals(new Integer(2), gb.getStandardEnumMap().get(CustomEnum.VALUE_2)); }
Example #11
Source File: BeanWrapperEnumTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testStandardEnumMapWithAutoGrowing() { GenericBean<?> gb = new GenericBean<>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setAutoGrowNestedPaths(true); assertNull(gb.getStandardEnumMap()); bw.setPropertyValue("standardEnumMap[VALUE_1]", 1); assertEquals(1, gb.getStandardEnumMap().size()); assertEquals(new Integer(1), gb.getStandardEnumMap().get(CustomEnum.VALUE_1)); }
Example #12
Source File: BeanWrapperEnumTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testCustomEnum() { GenericBean<?> gb = new GenericBean<Object>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setPropertyValue("customEnum", "VALUE_1"); assertEquals(CustomEnum.VALUE_1, gb.getCustomEnum()); }
Example #13
Source File: BeanWrapperEnumTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testCustomEnumArrayWithSingleValue() { GenericBean<?> gb = new GenericBean<Object>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setPropertyValue("customEnumArray", "VALUE_1"); assertEquals(1, gb.getCustomEnumArray().length); assertEquals(CustomEnum.VALUE_1, gb.getCustomEnumArray()[0]); }
Example #14
Source File: BeanWrapperEnumTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testCustomEnumArrayWithMultipleValues() { GenericBean<?> gb = new GenericBean<Object>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setPropertyValue("customEnumArray", new String[] {"VALUE_1", "VALUE_2"}); assertEquals(2, gb.getCustomEnumArray().length); assertEquals(CustomEnum.VALUE_1, gb.getCustomEnumArray()[0]); assertEquals(CustomEnum.VALUE_2, gb.getCustomEnumArray()[1]); }
Example #15
Source File: BeanWrapperEnumTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testCustomEnumArrayWithMultipleValuesAsCsv() { GenericBean<?> gb = new GenericBean<Object>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setPropertyValue("customEnumArray", "VALUE_1,VALUE_2"); assertEquals(2, gb.getCustomEnumArray().length); assertEquals(CustomEnum.VALUE_1, gb.getCustomEnumArray()[0]); assertEquals(CustomEnum.VALUE_2, gb.getCustomEnumArray()[1]); }
Example #16
Source File: BeanWrapperEnumTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testCustomEnumSetWithSingleValue() { GenericBean<?> gb = new GenericBean<Object>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setPropertyValue("customEnumSet", "VALUE_1"); assertEquals(1, gb.getCustomEnumSet().size()); assertTrue(gb.getCustomEnumSet().contains(CustomEnum.VALUE_1)); }
Example #17
Source File: BeanWrapperEnumTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testCustomEnumSetWithMultipleValues() { GenericBean<?> gb = new GenericBean<Object>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setPropertyValue("customEnumSet", new String[] {"VALUE_1", "VALUE_2"}); assertEquals(2, gb.getCustomEnumSet().size()); assertTrue(gb.getCustomEnumSet().contains(CustomEnum.VALUE_1)); assertTrue(gb.getCustomEnumSet().contains(CustomEnum.VALUE_2)); }
Example #18
Source File: BeanWrapperEnumTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testCustomEnumSetWithMultipleValuesAsCsv() { GenericBean<?> gb = new GenericBean<Object>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setPropertyValue("customEnumSet", "VALUE_1,VALUE_2"); assertEquals(2, gb.getCustomEnumSet().size()); assertTrue(gb.getCustomEnumSet().contains(CustomEnum.VALUE_1)); assertTrue(gb.getCustomEnumSet().contains(CustomEnum.VALUE_2)); }
Example #19
Source File: BeanWrapperEnumTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testCustomEnumSetWithGetterSetterMismatch() { GenericBean<?> gb = new GenericBean<Object>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setPropertyValue("customEnumSetMismatch", new String[] {"VALUE_1", "VALUE_2"}); assertEquals(2, gb.getCustomEnumSet().size()); assertTrue(gb.getCustomEnumSet().contains(CustomEnum.VALUE_1)); assertTrue(gb.getCustomEnumSet().contains(CustomEnum.VALUE_2)); }
Example #20
Source File: BeanWrapperEnumTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testStandardEnumSetWithMultipleValues() { GenericBean<?> gb = new GenericBean<Object>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setConversionService(new DefaultConversionService()); assertNull(gb.getStandardEnumSet()); bw.setPropertyValue("standardEnumSet", new String[] {"VALUE_1", "VALUE_2"}); assertEquals(2, gb.getStandardEnumSet().size()); assertTrue(gb.getStandardEnumSet().contains(CustomEnum.VALUE_1)); assertTrue(gb.getStandardEnumSet().contains(CustomEnum.VALUE_2)); }
Example #21
Source File: BeanWrapperEnumTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testStandardEnumMapWithMultipleValues() { GenericBean<?> gb = new GenericBean<Object>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setConversionService(new DefaultConversionService()); assertNull(gb.getStandardEnumMap()); Map<String, Integer> map = new LinkedHashMap<String, Integer>(); map.put("VALUE_1", 1); map.put("VALUE_2", 2); bw.setPropertyValue("standardEnumMap", map); assertEquals(2, gb.getStandardEnumMap().size()); assertEquals(new Integer(1), gb.getStandardEnumMap().get(CustomEnum.VALUE_1)); assertEquals(new Integer(2), gb.getStandardEnumMap().get(CustomEnum.VALUE_2)); }
Example #22
Source File: BeanWrapperEnumTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testStandardEnumSetWithMultipleValues() { GenericBean<?> gb = new GenericBean<>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setConversionService(new DefaultConversionService()); assertNull(gb.getStandardEnumSet()); bw.setPropertyValue("standardEnumSet", new String[] {"VALUE_1", "VALUE_2"}); assertEquals(2, gb.getStandardEnumSet().size()); assertTrue(gb.getStandardEnumSet().contains(CustomEnum.VALUE_1)); assertTrue(gb.getStandardEnumSet().contains(CustomEnum.VALUE_2)); }
Example #23
Source File: BeanWrapperEnumTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testCustomEnum() { GenericBean<?> gb = new GenericBean<>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setPropertyValue("customEnum", "VALUE_1"); assertEquals(CustomEnum.VALUE_1, gb.getCustomEnum()); }
Example #24
Source File: BeanWrapperEnumTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testCustomEnumArrayWithSingleValue() { GenericBean<?> gb = new GenericBean<>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setPropertyValue("customEnumArray", "VALUE_1"); assertEquals(1, gb.getCustomEnumArray().length); assertEquals(CustomEnum.VALUE_1, gb.getCustomEnumArray()[0]); }
Example #25
Source File: BeanWrapperEnumTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testCustomEnumArrayWithMultipleValues() { GenericBean<?> gb = new GenericBean<>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setPropertyValue("customEnumArray", new String[] {"VALUE_1", "VALUE_2"}); assertEquals(2, gb.getCustomEnumArray().length); assertEquals(CustomEnum.VALUE_1, gb.getCustomEnumArray()[0]); assertEquals(CustomEnum.VALUE_2, gb.getCustomEnumArray()[1]); }
Example #26
Source File: BeanWrapperEnumTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testCustomEnumArrayWithMultipleValuesAsCsv() { GenericBean<?> gb = new GenericBean<>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setPropertyValue("customEnumArray", "VALUE_1,VALUE_2"); assertEquals(2, gb.getCustomEnumArray().length); assertEquals(CustomEnum.VALUE_1, gb.getCustomEnumArray()[0]); assertEquals(CustomEnum.VALUE_2, gb.getCustomEnumArray()[1]); }
Example #27
Source File: BeanWrapperEnumTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testCustomEnumSetWithSingleValue() { GenericBean<?> gb = new GenericBean<>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setPropertyValue("customEnumSet", "VALUE_1"); assertEquals(1, gb.getCustomEnumSet().size()); assertTrue(gb.getCustomEnumSet().contains(CustomEnum.VALUE_1)); }
Example #28
Source File: BeanWrapperEnumTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testCustomEnumSetWithMultipleValues() { GenericBean<?> gb = new GenericBean<>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setPropertyValue("customEnumSet", new String[] {"VALUE_1", "VALUE_2"}); assertEquals(2, gb.getCustomEnumSet().size()); assertTrue(gb.getCustomEnumSet().contains(CustomEnum.VALUE_1)); assertTrue(gb.getCustomEnumSet().contains(CustomEnum.VALUE_2)); }
Example #29
Source File: BeanWrapperEnumTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testCustomEnumSetWithMultipleValuesAsCsv() { GenericBean<?> gb = new GenericBean<>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setPropertyValue("customEnumSet", "VALUE_1,VALUE_2"); assertEquals(2, gb.getCustomEnumSet().size()); assertTrue(gb.getCustomEnumSet().contains(CustomEnum.VALUE_1)); assertTrue(gb.getCustomEnumSet().contains(CustomEnum.VALUE_2)); }
Example #30
Source File: BeanWrapperEnumTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testCustomEnumSetWithGetterSetterMismatch() { GenericBean<?> gb = new GenericBean<>(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.setPropertyValue("customEnumSetMismatch", new String[] {"VALUE_1", "VALUE_2"}); assertEquals(2, gb.getCustomEnumSet().size()); assertTrue(gb.getCustomEnumSet().contains(CustomEnum.VALUE_1)); assertTrue(gb.getCustomEnumSet().contains(CustomEnum.VALUE_2)); }