org.springframework.web.servlet.mvc.method.annotation.ExtendedServletRequestDataBinder Java Examples
The following examples show how to use
org.springframework.web.servlet.mvc.method.annotation.ExtendedServletRequestDataBinder.
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: JseDefaultDatePropertyEditorRegistrarTest.java From sinavi-jfw with Apache License 2.0 | 5 votes |
@Test public void Date型のプロパティエディタが検索できる() { registry = new ExtendedServletRequestDataBinder(new TestBean()); registrar = new JseDefaultDatePropertyEditorRegistrar(); registrar.registerCustomEditors(registry); PropertyEditor editor = registry.findCustomEditor(Date.class, "birth"); assertThat(editor, is(notNullValue())); assertThat(editor.getClass().getName(), is(DateEditor.class.getName())); }
Example #2
Source File: JseDefaultDatePropertyEditorRegistrarTest.java From sinavi-jfw with Apache License 2.0 | 5 votes |
@Test public void allowEmptyプロパティの設定が反映される() { registry = new ExtendedServletRequestDataBinder(new TestBean()); registrar = new JseDefaultDatePropertyEditorRegistrar(); registrar.setAllowEmpty(true); registrar.registerCustomEditors(registry); PropertyEditor editor = registry.findCustomEditor(Date.class, "birth"); DateEditor dateEditor = (DateEditor)editor; dateEditor.setAsText(null); assertThat(dateEditor.getAsText(), is("")); }
Example #3
Source File: JseDefaultDatePropertyEditorRegistrarTest.java From sinavi-jfw with Apache License 2.0 | 5 votes |
@Test public void patternプロパティの設定が反映される() { registry = new ExtendedServletRequestDataBinder(new TestBean()); registrar = new JseDefaultDatePropertyEditorRegistrar(); registrar.setPattern("yyyy-MM-dd"); registrar.registerCustomEditors(registry); PropertyEditor editor = registry.findCustomEditor(Date.class, "birth"); DateEditor dateEditor = (DateEditor)editor; dateEditor.setAsText("2013-01-01"); assertThat(dateEditor.getAsText(), is("2013-01-01")); }
Example #4
Source File: JseDefaultNumberPropertyEditorRegistrarTest.java From sinavi-jfw with Apache License 2.0 | 5 votes |
@Test public void 各タイプに合わせたプロパティエディタ一括登録されていることを確認() { registry = new ExtendedServletRequestDataBinder(new TestBean()); registrar = new JseDefaultNumberPropertyEditorRegistrar(); registrar.registerCustomEditors(registry); PropertyEditor editor = registry.findCustomEditor(Byte.class, "byteP"); assertThat(editor, is(notNullValue())); assertThat(editor.getClass().getName(), is(HalfwidthNumberEditor.class.getName())); editor = registry.findCustomEditor(Short.class, "shortP"); assertThat(editor, is(notNullValue())); assertThat(editor.getClass().getName(), is(HalfwidthNumberEditor.class.getName())); editor = registry.findCustomEditor(Integer.class, "integerP"); assertThat(editor, is(notNullValue())); assertThat(editor.getClass().getName(), is(HalfwidthNumberEditor.class.getName())); editor = registry.findCustomEditor(Long.class, "longP"); assertThat(editor, is(notNullValue())); assertThat(editor.getClass().getName(), is(HalfwidthNumberEditor.class.getName())); editor = registry.findCustomEditor(BigInteger.class, "bigIntegerP"); assertThat(editor, is(notNullValue())); assertThat(editor.getClass().getName(), is(HalfwidthNumberEditor.class.getName())); editor = registry.findCustomEditor(Float.class, "floatP"); assertThat(editor, is(nullValue())); editor = registry.findCustomEditor(Double.class, "doubleP"); assertThat(editor, is(nullValue())); editor = registry.findCustomEditor(BigDecimal.class, "bigDecimalP"); assertThat(editor, is(notNullValue())); assertThat(editor.getClass().getName(), is(HalfwidthDecimalEditor.class.getName())); }
Example #5
Source File: JseDefaultNumberPropertyEditorRegistrarTest.java From sinavi-jfw with Apache License 2.0 | 5 votes |
@Test public void allowEmptyプロパティの設定が反映される() { registry = new ExtendedServletRequestDataBinder(new TestBean()); registrar = new JseDefaultNumberPropertyEditorRegistrar(); registrar.setAllowEmpty(true); registrar.registerCustomEditors(registry); PropertyEditor editor = registry.findCustomEditor(Byte.class, "byteP"); editor.setAsText(null); assertThat(editor.getAsText(), is("")); }