本文整理了Java中org.ehcache.xml.exceptions.XmlConfigurationException.getMessage()
方法的一些代码示例,展示了XmlConfigurationException.getMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlConfigurationException.getMessage()
方法的具体详情如下:
包路径:org.ehcache.xml.exceptions.XmlConfigurationException
类名称:XmlConfigurationException
方法名:getMessage
暂无
代码示例来源:origin: ehcache/ehcache3
@Test
public void testTwoCachesWithSameAlias() {
try {
new XmlConfiguration(XmlConfigurationTest.class.getResource("/configs/invalid-two-caches.xml"));
fail("Two caches with the same alias should not be allowed");
} catch (XmlConfigurationException e) {
assertThat(e.getMessage(), is("Two caches defined with the same alias: foo"));
}
}
代码示例来源:origin: ehcache/ehcache3
@Test
public void testCustomResource() throws Exception {
try {
new XmlConfiguration(XmlConfigurationTest.class.getResource("/configs/custom-resource.xml"));
fail();
} catch (XmlConfigurationException xce) {
assertThat(xce.getMessage(), containsString("Can't find parser for element"));
}
}
代码示例来源:origin: ehcache/ehcache3
@Test
public void testGetTimeoutValueTooBig() throws Exception {
final String[] config = new String[]
{
"<ehcache:config",
" xmlns:ehcache=\"http://www.ehcache.org/v3\"",
" xmlns:tc=\"http://www.ehcache.org/v3/clustered\">",
"",
" <ehcache:service>",
" <tc:cluster>",
" <tc:connection url=\"terracotta://example.com:9540/cachemanager\"/>",
" <tc:read-timeout unit=\"seconds\">"
+ BigInteger.ONE.add(BigInteger.valueOf(Long.MAX_VALUE))
+ "</tc:read-timeout>",
" </tc:cluster>",
" </ehcache:service>",
"",
"</ehcache:config>"
};
try {
new XmlConfiguration(makeConfig(config));
fail("Expecting XmlConfigurationException");
} catch (XmlConfigurationException e) {
assertThat(e.getMessage(), containsString(" exceeds allowed value "));
}
}
代码示例来源:origin: ehcache/ehcache3
@Test
public void testGetTimeoutUnitBad() throws Exception {
final String[] config = new String[]
{
"<ehcache:config",
" xmlns:ehcache=\"http://www.ehcache.org/v3\"",
" xmlns:tc=\"http://www.ehcache.org/v3/clustered\">",
"",
" <ehcache:service>",
" <tc:cluster>",
" <tc:connection url=\"terracotta://example.com:9540/cachemanager\"/>",
" <tc:read-timeout unit=\"femtos\">5</tc:read-timeout>",
" </tc:cluster>",
" </ehcache:service>",
"",
"</ehcache:config>"
};
try {
new XmlConfiguration(makeConfig(config));
fail("Expecting XmlConfigurationException");
} catch (XmlConfigurationException e) {
assertThat(e.getMessage(), containsString("Error parsing XML configuration "));
assertThat(e.getCause().getMessage(), containsString("Value 'femtos' is not facet-valid with respect to enumeration "));
}
}
代码示例来源:origin: ehcache/ehcache3
@Test
public void testGetTimeoutValueOmitted() throws Exception {
final String[] config = new String[]
{
"<ehcache:config",
" xmlns:ehcache=\"http://www.ehcache.org/v3\"",
" xmlns:tc=\"http://www.ehcache.org/v3/clustered\">",
"",
" <ehcache:service>",
" <tc:cluster>",
" <tc:connection url=\"terracotta://example.com:9540/cachemanager\"/>",
" <tc:read-timeout unit=\"seconds\"></tc:read-timeout>",
" </tc:cluster>",
" </ehcache:service>",
"",
"</ehcache:config>"
};
try {
new XmlConfiguration(makeConfig(config));
fail("Expecting XmlConfigurationException");
} catch (XmlConfigurationException e) {
assertThat(e.getMessage(), containsString("Error parsing XML configuration "));
assertThat(e.getCause().getMessage(), containsString("'' is not a valid value for 'integer'"));
}
}
内容来源于网络,如有侵权,请联系作者删除!