@Test void populateWhenMissingMandatoryProperty() { Throwable exception = assertThrows(PropertyMandatoryException.class, () -> this.defaultBeanManager.populate(new TestBean(), new HashMap<String, String>())); assertEquals("Property [prop2] mandatory", exception.getMessage()); }
@Override public void populate(Object bean, Map<String, ?> values) throws PropertyException { Map<String, Object> remainingValues = new HashMap<>(values); populateBean(bean, remainingValues); if (!remainingValues.isEmpty() && bean instanceof RawProperties) { RawProperties rawProperties = (RawProperties) bean; for (Map.Entry<String, Object> entry : remainingValues.entrySet()) { rawProperties.set(entry.getKey(), entry.getValue()); } } validateBean(bean); }
DefaultBeanManager implements BeanManager { @Override public void populate(Object bean, Map<String, ?> values) throws PropertyException { Map<String, Object> remainingValues = new HashMap<>(values); populateBean(bean, remainingValues); if (!remainingValues.isEmpty() && bean instanceof RawProperties) { RawProperties rawProperties = (RawProperties) bean; for (Map.Entry<String, Object> entry : remainingValues.entrySet()) { rawProperties.set(entry.getKey(), entry.getValue()); } } validateBean(bean); } }
DefaultBeanManager implements BeanManager { @Override public void populate(Object bean, Map<String, ?> values) throws PropertyException { Map<String, Object> remainingValues = new HashMap<>(values); populateBean(bean, remainingValues); if (!remainingValues.isEmpty() && bean instanceof RawProperties) { RawProperties rawProperties = (RawProperties) bean; for (Map.Entry<String, Object> entry : remainingValues.entrySet()) { rawProperties.set(entry.getKey(), entry.getValue()); } } validateBean(bean); }  }
DefaultBeanManager implements BeanManager { @Override public void populate(Object bean, Map<String, ?> values) throws PropertyException { Map<String, Object> remainingValues = new HashMap<>(values); populateBean(bean, remainingValues); if (!remainingValues.isEmpty() && bean instanceof RawProperties) { RawProperties rawProperties = (RawProperties) bean; for (Map.Entry<String, Object> entry : remainingValues.entrySet()) { rawProperties.set(entry.getKey(), entry.getValue()); } } validateBean(bean); }  ValidatorFactory getValidatorFactory(); @Override void populate(Object bean, Map<String, ?> values); @Override BeanDescriptor getBeanDescriptor(Class<?> beanClass); }
DefaultBeanManager implements BeanManager { @Override public void populate(Object bean, Map<String, ?> values) throws PropertyException { Map<String, Object> remainingValues = new HashMap<>(values); populateBean(bean, remainingValues); if (!remainingValues.isEmpty() && bean instanceof RawProperties) { RawProperties rawProperties = (RawProperties) bean; for (Map.Entry<String, Object> entry : remainingValues.entrySet()) { rawProperties.set(entry.getKey(), entry.getValue()); } } validateBean(bean); }  ValidatorFactory getValidatorFactory(); @Override void populate(Object bean, Map<String, ?> values); @Override BeanDescriptor getBeanDescriptor(Class<?> beanClass);  }