use of org.apache.ibatis.cache.impl.PerpetualCache in project mybatis-3 by mybatis.
the class SqlSessionTest method shouldFailToAddDueToNameConflict.
@Test
public void shouldFailToAddDueToNameConflict() {
Configuration c = new Configuration();
final String fullName = "com.mycache.MyCache";
final PerpetualCache cache = new PerpetualCache(fullName);
try {
c.addCache(cache);
c.addCache(cache);
fail("Exception expected.");
} catch (Exception e) {
assertTrue(e.getMessage().contains("already contains value"));
}
}
use of org.apache.ibatis.cache.impl.PerpetualCache in project mybatis-3 by mybatis.
the class SqlSessionTest method shouldFailOverToMostApplicableSimpleName.
@Test(expected = IllegalArgumentException.class)
public void shouldFailOverToMostApplicableSimpleName() {
Configuration c = new Configuration();
final String fullName = "com.mycache.MyCache";
final String invalidName = "unknown.namespace.MyCache";
final PerpetualCache cache = new PerpetualCache(fullName);
c.addCache(cache);
assertEquals(cache, c.getCache(fullName));
assertEquals(cache, c.getCache(invalidName));
}
Aggregations