TableNameUtil { public void checkTableName(final CharSequence name) { if (name.charAt(0) == SINGLE_QUOTE) { throw new IllegalArgumentException( "Table name should not start with " + SINGLE_QUOTE + ": " + name); } for (int i = 0; i < name.length(); i++) { final char c = name.charAt(i); for (final char fc : FORBIDDEN_CHARS) { if (c == fc) { throw new IllegalArgumentException( "Table name should not contain " + new String(FORBIDDEN_CHARS) + ": " + name); } } } }  void checkTableName(final CharSequence name); String escapeTableName(final CharSequence tableName); String unescapeFilename(final String filename); String unescapeQuotes(final String str);  }
@Test public void testCheckTableNameQuoteAtFirstPlace() { this.exception.expect(IllegalArgumentException.class); this.exception.expectMessage("Table name should not start with ': 'quote at first place"); this.util.checkTableName("'quote at first place"); }
@Test public void testCheckTableNameNoQuoteAtFirstPlace() { this.util.checkTableName(" 'quote at second place"); }
@Test public void testCheckTableNameForbiddenChar1() { this.exception.expect(IllegalArgumentException.class); this.exception.expectMessage("Table name should not contain []*?:/\\: a name with ["); this.util.checkTableName("a name with ["); }
@Test public void testCheckTableNameForbiddenChar2() { this.exception.expect(IllegalArgumentException.class); this.exception.expectMessage("Table name should not contain []*?:/\\: a name with ]"); this.util.checkTableName("a name with ]"); }
@Test public void testCheckTableNameForbiddenChar3() { this.exception.expect(IllegalArgumentException.class); this.exception.expectMessage("Table name should not contain []*?:/\\: a name with *"); this.util.checkTableName("a name with *"); }
@Test public void testCheckTableNameForbiddenChar4() { this.exception.expect(IllegalArgumentException.class); this.exception.expectMessage("Table name should not contain []*?:/\\: a name with ?"); this.util.checkTableName("a name with ?"); }
@Test public void testCheckTableNameForbiddenChar5() { this.exception.expect(IllegalArgumentException.class); this.exception.expectMessage("Table name should not contain []*?:/\\: a name with :"); this.util.checkTableName("a name with :"); }
@Test public void testCheckTableNameForbiddenChar6() { this.exception.expect(IllegalArgumentException.class); this.exception.expectMessage("Table name should not contain []*?:/\\: a name with /"); this.util.checkTableName("a name with /"); }
@Test public void testCheckTableNameForbiddenChar7() { this.exception.expect(IllegalArgumentException.class); this.exception.expectMessage("Table name should not contain []*?:/\\: a name with \\"); this.util.checkTableName("a name with \\"); }