org.springframework.validation.beanvalidation.BeanValidationPostProcessor Java Examples
The following examples show how to use
org.springframework.validation.beanvalidation.BeanValidationPostProcessor.
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: BeanValidationPostProcessorTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void testNotNullConstraint() { GenericApplicationContext ac = new GenericApplicationContext(); ac.registerBeanDefinition("bvpp", new RootBeanDefinition(BeanValidationPostProcessor.class)); ac.registerBeanDefinition("capp", new RootBeanDefinition(CommonAnnotationBeanPostProcessor.class)); ac.registerBeanDefinition("bean", new RootBeanDefinition(NotNullConstrainedBean.class)); try { ac.refresh(); fail("Should have thrown BeanCreationException"); } catch (BeanCreationException ex) { assertTrue(ex.getRootCause().getMessage().contains("testBean")); assertTrue(ex.getRootCause().getMessage().contains("invalid")); } ac.close(); }
Example #2
Source File: BeanValidationPostProcessorTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void testSizeConstraint() { GenericApplicationContext ac = new GenericApplicationContext(); ac.registerBeanDefinition("bvpp", new RootBeanDefinition(BeanValidationPostProcessor.class)); RootBeanDefinition bd = new RootBeanDefinition(NotNullConstrainedBean.class); bd.getPropertyValues().add("testBean", new TestBean()); bd.getPropertyValues().add("stringValue", "s"); ac.registerBeanDefinition("bean", bd); try { ac.refresh(); fail("Should have thrown BeanCreationException"); } catch (BeanCreationException ex) { assertTrue(ex.getRootCause().getMessage().contains("stringValue")); assertTrue(ex.getRootCause().getMessage().contains("invalid")); } ac.close(); }
Example #3
Source File: BeanValidationPostProcessorTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void testNotNullConstraint() { GenericApplicationContext ac = new GenericApplicationContext(); ac.registerBeanDefinition("bvpp", new RootBeanDefinition(BeanValidationPostProcessor.class)); ac.registerBeanDefinition("capp", new RootBeanDefinition(CommonAnnotationBeanPostProcessor.class)); ac.registerBeanDefinition("bean", new RootBeanDefinition(NotNullConstrainedBean.class)); try { ac.refresh(); fail("Should have thrown BeanCreationException"); } catch (BeanCreationException ex) { assertTrue(ex.getRootCause().getMessage().contains("testBean")); assertTrue(ex.getRootCause().getMessage().contains("invalid")); } ac.close(); }
Example #4
Source File: BeanValidationPostProcessorTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void testSizeConstraint() { GenericApplicationContext ac = new GenericApplicationContext(); ac.registerBeanDefinition("bvpp", new RootBeanDefinition(BeanValidationPostProcessor.class)); RootBeanDefinition bd = new RootBeanDefinition(NotNullConstrainedBean.class); bd.getPropertyValues().add("testBean", new TestBean()); bd.getPropertyValues().add("stringValue", "s"); ac.registerBeanDefinition("bean", bd); try { ac.refresh(); fail("Should have thrown BeanCreationException"); } catch (BeanCreationException ex) { assertTrue(ex.getRootCause().getMessage().contains("stringValue")); assertTrue(ex.getRootCause().getMessage().contains("invalid")); } ac.close(); }
Example #5
Source File: BeanValidationPostProcessorTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void testNotNullConstraint() { GenericApplicationContext ac = new GenericApplicationContext(); ac.registerBeanDefinition("bvpp", new RootBeanDefinition(BeanValidationPostProcessor.class)); ac.registerBeanDefinition("capp", new RootBeanDefinition(CommonAnnotationBeanPostProcessor.class)); ac.registerBeanDefinition("bean", new RootBeanDefinition(NotNullConstrainedBean.class)); try { ac.refresh(); fail("Should have thrown BeanCreationException"); } catch (BeanCreationException ex) { assertTrue(ex.getRootCause().getMessage().contains("testBean")); assertTrue(ex.getRootCause().getMessage().contains("invalid")); } ac.close(); }
Example #6
Source File: BeanValidationPostProcessorTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void testSizeConstraint() { GenericApplicationContext ac = new GenericApplicationContext(); ac.registerBeanDefinition("bvpp", new RootBeanDefinition(BeanValidationPostProcessor.class)); RootBeanDefinition bd = new RootBeanDefinition(NotNullConstrainedBean.class); bd.getPropertyValues().add("testBean", new TestBean()); bd.getPropertyValues().add("stringValue", "s"); ac.registerBeanDefinition("bean", bd); try { ac.refresh(); fail("Should have thrown BeanCreationException"); } catch (BeanCreationException ex) { assertTrue(ex.getRootCause().getMessage().contains("stringValue")); assertTrue(ex.getRootCause().getMessage().contains("invalid")); } ac.close(); }
Example #7
Source File: BeanValidationPostProcessorTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testNotNullConstraintSatisfied() { GenericApplicationContext ac = new GenericApplicationContext(); ac.registerBeanDefinition("bvpp", new RootBeanDefinition(BeanValidationPostProcessor.class)); ac.registerBeanDefinition("capp", new RootBeanDefinition(CommonAnnotationBeanPostProcessor.class)); RootBeanDefinition bd = new RootBeanDefinition(NotNullConstrainedBean.class); bd.getPropertyValues().add("testBean", new TestBean()); ac.registerBeanDefinition("bean", bd); ac.refresh(); ac.close(); }
Example #8
Source File: BeanValidationPostProcessorTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testNotNullConstraintAfterInitialization() { GenericApplicationContext ac = new GenericApplicationContext(); RootBeanDefinition bvpp = new RootBeanDefinition(BeanValidationPostProcessor.class); bvpp.getPropertyValues().add("afterInitialization", true); ac.registerBeanDefinition("bvpp", bvpp); ac.registerBeanDefinition("capp", new RootBeanDefinition(CommonAnnotationBeanPostProcessor.class)); ac.registerBeanDefinition("bean", new RootBeanDefinition(AfterInitConstraintBean.class)); ac.refresh(); ac.close(); }
Example #9
Source File: BeanValidationPostProcessorTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testSizeConstraintSatisfied() { GenericApplicationContext ac = new GenericApplicationContext(); ac.registerBeanDefinition("bvpp", new RootBeanDefinition(BeanValidationPostProcessor.class)); RootBeanDefinition bd = new RootBeanDefinition(NotNullConstrainedBean.class); bd.getPropertyValues().add("testBean", new TestBean()); bd.getPropertyValues().add("stringValue", "ss"); ac.registerBeanDefinition("bean", bd); ac.refresh(); ac.close(); }
Example #10
Source File: BeanValidationPostProcessorTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testNotNullConstraintSatisfied() { GenericApplicationContext ac = new GenericApplicationContext(); ac.registerBeanDefinition("bvpp", new RootBeanDefinition(BeanValidationPostProcessor.class)); ac.registerBeanDefinition("capp", new RootBeanDefinition(CommonAnnotationBeanPostProcessor.class)); RootBeanDefinition bd = new RootBeanDefinition(NotNullConstrainedBean.class); bd.getPropertyValues().add("testBean", new TestBean()); ac.registerBeanDefinition("bean", bd); ac.refresh(); ac.close(); }
Example #11
Source File: BeanValidationPostProcessorTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testNotNullConstraintAfterInitialization() { GenericApplicationContext ac = new GenericApplicationContext(); RootBeanDefinition bvpp = new RootBeanDefinition(BeanValidationPostProcessor.class); bvpp.getPropertyValues().add("afterInitialization", true); ac.registerBeanDefinition("bvpp", bvpp); ac.registerBeanDefinition("capp", new RootBeanDefinition(CommonAnnotationBeanPostProcessor.class)); ac.registerBeanDefinition("bean", new RootBeanDefinition(AfterInitConstraintBean.class)); ac.refresh(); ac.close(); }
Example #12
Source File: BeanValidationPostProcessorTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testSizeConstraintSatisfied() { GenericApplicationContext ac = new GenericApplicationContext(); ac.registerBeanDefinition("bvpp", new RootBeanDefinition(BeanValidationPostProcessor.class)); RootBeanDefinition bd = new RootBeanDefinition(NotNullConstrainedBean.class); bd.getPropertyValues().add("testBean", new TestBean()); bd.getPropertyValues().add("stringValue", "ss"); ac.registerBeanDefinition("bean", bd); ac.refresh(); ac.close(); }
Example #13
Source File: BeanValidationPostProcessorTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testNotNullConstraintSatisfied() { GenericApplicationContext ac = new GenericApplicationContext(); ac.registerBeanDefinition("bvpp", new RootBeanDefinition(BeanValidationPostProcessor.class)); ac.registerBeanDefinition("capp", new RootBeanDefinition(CommonAnnotationBeanPostProcessor.class)); RootBeanDefinition bd = new RootBeanDefinition(NotNullConstrainedBean.class); bd.getPropertyValues().add("testBean", new TestBean()); ac.registerBeanDefinition("bean", bd); ac.refresh(); ac.close(); }
Example #14
Source File: BeanValidationPostProcessorTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testNotNullConstraintAfterInitialization() { GenericApplicationContext ac = new GenericApplicationContext(); RootBeanDefinition bvpp = new RootBeanDefinition(BeanValidationPostProcessor.class); bvpp.getPropertyValues().add("afterInitialization", true); ac.registerBeanDefinition("bvpp", bvpp); ac.registerBeanDefinition("capp", new RootBeanDefinition(CommonAnnotationBeanPostProcessor.class)); ac.registerBeanDefinition("bean", new RootBeanDefinition(AfterInitConstraintBean.class)); ac.refresh(); ac.close(); }
Example #15
Source File: BeanValidationPostProcessorTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testSizeConstraintSatisfied() { GenericApplicationContext ac = new GenericApplicationContext(); ac.registerBeanDefinition("bvpp", new RootBeanDefinition(BeanValidationPostProcessor.class)); RootBeanDefinition bd = new RootBeanDefinition(NotNullConstrainedBean.class); bd.getPropertyValues().add("testBean", new TestBean()); bd.getPropertyValues().add("stringValue", "ss"); ac.registerBeanDefinition("bean", bd); ac.refresh(); ac.close(); }