@Test public void shouldInstantiateAndThrowAllCustomExceptions() throws Exception { Class<?>[] exceptionTypes = { BindingException.class, CacheException.class, DataSourceException.class, ExecutorException.class, LogException.class, ParsingException.class, BuilderException.class, PluginException.class, ReflectionException.class, PersistenceException.class, SqlSessionException.class, TransactionException.class, TypeException.class, ScriptingException.class }; for (Class<?> exceptionType : exceptionTypes) { testExceptionConstructors(exceptionType); } }
/** * 统计匹配的总记录数 * * @param mapperId * @param object * @return */ @Override public int count(String mapperId, Object object) { Integer integer = getSqlSessionTemplate().selectOne(mapperId, object); if(integer == null){ throw new SqlSessionException("Error: Sql statement is only support select count/sum from tablename. Please check sql statement"); } return integer; }