SqlBodyUtil { public static String limitSqlBodySize(String sql) { if (sql == null) { return EMPTY_STRING; } if (JDBCPluginConfig.Plugin.JDBC.SQL_BODY_MAX_LENGTH > 0 && sql.length() > JDBCPluginConfig.Plugin.JDBC.SQL_BODY_MAX_LENGTH) { return sql.substring(0, JDBCPluginConfig.Plugin.JDBC.SQL_BODY_MAX_LENGTH) + "..."; } return sql; }  static String limitSqlBodySize(String sql);  }
@Test public void testBuildWithEmptySqlBody() { String sql = SqlBodyUtil.limitSqlBodySize(null); assertThat(sql, is("")); }
@Test public void testBuildWithDefaultLength() { JDBCPluginConfig.Plugin.JDBC.SQL_BODY_MAX_LENGTH = 2048; String sql = SqlBodyUtil.limitSqlBodySize("select * from dual"); assertThat(sql, is("select * from dual")); }
@Test public void testBuildWithMaxLength() { JDBCPluginConfig.Plugin.JDBC.SQL_BODY_MAX_LENGTH = 10; String sql = SqlBodyUtil.limitSqlBodySize("select * from dual"); assertThat(sql, is("select * f...")); }