List of usage examples for org.springframework.beans.factory BeanCreationException getMessage
@Override
@Nullable
public String getMessage()
From source file:cf.spring.servicebroker.ServiceBrokerConfigTest.java
@Test public void serviceBrokerWrongReturnType() { try (ConfigurableApplicationContext context = new AnnotationConfigApplicationContext( WrongReturnTypeProvisionAnnotationServiceBrokerConfig.class)) { fail("Should have thrown " + BeanCreationException.class.getName()); } catch (BeanCreationException e) { assertTrue(e.getMessage().contains("must have a return type of " + ProvisionResponse.class.getName())); }/*from ww w.ja va 2 s . c o m*/ }
From source file:cf.spring.servicebroker.ServiceBrokerConfigTest.java
@Test public void serviceBrokerWrongParameterType() { try (ConfigurableApplicationContext context = new AnnotationConfigApplicationContext( WrongParameterTypeProvisionAnnotationServiceBrokerConfig.class)) { fail("Should have thrown " + BeanCreationException.class.getName()); } catch (BeanCreationException e) { assertTrue(e.getMessage() .contains("MUST take a single argument of type " + ProvisionRequest.class.getName())); }//from w w w. ja v a 2 s . co m }
From source file:io.pivotal.spring.cloud.service.eureka.SanitizingEurekaInstanceConfigBeanTest.java
@Test public void testExceptionThrownIfVhnDiffersFromAppName() { try {//from ww w .j ava 2 s. c om createBeanWithProps("spring.application.name:san", "eureka.instance.appname:ean", "eureka.instance.virtualHostName:vhn", "eureka.instance.secureVirtualHostName:ean"); } catch (BeanCreationException e) { Assert.assertThat(e.getMessage(), Matchers.containsString("eureka.instance.virtualHostName")); return; } Assert.fail(); }
From source file:io.pivotal.spring.cloud.service.eureka.SanitizingEurekaInstanceConfigBeanTest.java
@Test public void testExceptionThrownIfSvhnDiffersFromAppName() { try {//from ww w.j av a2s . c o m createBeanWithProps("spring.application.name:san", "eureka.instance.appname:ean", "eureka.instance.virtualHostName:ean", "eureka.instance.secureVirtualHostName:svhn"); } catch (BeanCreationException e) { Assert.assertThat(e.getMessage(), Matchers.containsString("eureka.instance.secureVirtualHostName")); return; } Assert.fail(); }
From source file:org.mitre.openid.connect.config.ConfigurationPropertiesBeanTest.java
@Test public void testCheckForHttpsIssuerHttpFalseFlag() { ConfigurationPropertiesBean bean = new ConfigurationPropertiesBean(); // issuer is http // set to false try {// www.j a v a2s. c o m bean.setIssuer("http://localhost:8080/openid-connect-server/"); bean.setForceHttps(false); bean.checkConfigConsistency(); } catch (BeanCreationException e) { fail("Unexpected BeanCreationException for http issuer with forceHttps=false, message:" + e.getMessage()); } }
From source file:org.mitre.openid.connect.config.ConfigurationPropertiesBeanTest.java
@Test public void testCheckForHttpsIssuerHttpsFalseFlag() { ConfigurationPropertiesBean bean = new ConfigurationPropertiesBean(); // issuer is https // set to false try {//from w w w . jav a 2s.c o m bean.setIssuer("https://localhost:8080/openid-connect-server/"); bean.setForceHttps(false); bean.checkConfigConsistency(); } catch (BeanCreationException e) { fail("Unexpected BeanCreationException for https issuer with forceHttps=false, message:" + e.getMessage()); } }
From source file:org.mitre.openid.connect.config.ConfigurationPropertiesBeanTest.java
@Test public void testCheckForHttpsIssuerHttpsTrueFlag() { ConfigurationPropertiesBean bean = new ConfigurationPropertiesBean(); // issuer is https // set to true try {//from w w w . j a v a2s . c o m bean.setIssuer("https://localhost:8080/openid-connect-server/"); bean.setForceHttps(true); bean.checkConfigConsistency(); } catch (BeanCreationException e) { fail("Unexpected BeanCreationException for https issuer with forceHttps=true, message:" + e.getMessage()); } }
From source file:org.mitre.openid.connect.config.ConfigurationPropertiesBeanTest.java
@Test public void testCheckForHttpsIssuerHttpDefaultFlag() { ConfigurationPropertiesBean bean = new ConfigurationPropertiesBean(); // issuer is http // leave as default, which is unset/false try {/*from w w w. ja v a 2s.c om*/ bean.setIssuer("http://localhost:8080/openid-connect-server/"); bean.checkConfigConsistency(); } catch (BeanCreationException e) { fail("Unexpected BeanCreationException for http issuer with default forceHttps, message:" + e.getMessage()); } }
From source file:org.mitre.openid.connect.config.ConfigurationPropertiesBeanTest.java
@Test public void testCheckForHttpsIssuerHttpsDefaultFlag() { ConfigurationPropertiesBean bean = new ConfigurationPropertiesBean(); // issuer is https // leave as default, which is unset/false try {/*from w w w .j a v a 2 s . co m*/ bean.setIssuer("https://localhost:8080/openid-connect-server/"); bean.checkConfigConsistency(); } catch (BeanCreationException e) { fail("Unexpected BeanCreationException for https issuer with default forceHttps, message:" + e.getMessage()); } }
From source file:org.mybatis.spring.boot.autoconfigure.MybatisAutoConfigurationTest.java
@Test public void testConfigFileAndConfigurationWithTogether() { TestPropertyValues.of("mybatis.config-location:mybatis-config.xml", "mybatis.configuration.default-statement-timeout:30").applyTo(this.context); this.context.register(EmbeddedDataSourceConfiguration.class, MybatisAutoConfiguration.class); try {// ww w . j a v a 2s . c o m this.context.refresh(); fail("Should be occurred a BeanCreationException."); } catch (BeanCreationException e) { assertThat(e.getMessage()) .contains("Property 'configuration' and 'configLocation' can not specified with together"); } }