### Question:
ShardingUtil { static void removeIfTailHasString(StringBuilder original, String targetStr) { int whiteFieldsLength = original.length(); if (whiteFieldsLength > 0 && original.lastIndexOf(targetStr) == whiteFieldsLength - 1) { original.deleteCharAt(whiteFieldsLength - 1); } }  static String debugSql(SQLObject o, boolean printType); static String debugSql(SQLObject o); static SafeSQL mostSafeSQLAndWhiteFields(List<SQLStatement> sqlStatements,
        Predicate<String> whiteFieldsFilter); static String getVal(SQLExpr e); static Number getNumberVal(SQLExpr e); static String removeLiteralSymbol(String input, char literalSymbol); static void checkLiteralSymbolAndReplaceTable(SQLExpr e, String tableNameLowerCase,
        Consumer<SQLPropertyExpr> method, char literalSymbol); static boolean isPGObject(SQLObject o);  }### Answer:
@Test public void testRemoveIf() throws Exception { StringBuilder sb1 = new StringBuilder("#"); StringBuilder sb2 = new StringBuilder("1#"); StringBuilder sb3 = new StringBuilder("dsfhdskhf#"); StringBuilder sb4 = new StringBuilder("sdfhksdhk"); StringBuilder sb5 = new StringBuilder("sdfhks#dhk"); StringBuilder sb6 = new StringBuilder("#sdfhks#dhk"); ShardingUtil.removeIfTailHasString(sb1, "#"); ShardingUtil.removeIfTailHasString(sb2, "#"); ShardingUtil.removeIfTailHasString(sb3, "#"); ShardingUtil.removeIfTailHasString(sb4, "#"); ShardingUtil.removeIfTailHasString(sb5, "#"); ShardingUtil.removeIfTailHasString(sb6, "#"); Assert.assertEquals(sb1.toString(), ""); Assert.assertEquals(sb2.toString(), "1"); Assert.assertEquals(sb3.toString(), "dsfhdskhf"); Assert.assertEquals(sb4.toString(), "sdfhksdhk"); Assert.assertEquals(sb5.toString(), "sdfhks#dhk"); Assert.assertEquals(sb6.toString(), "#sdfhks#dhk"); }