Validator { static String sanitizeField(QueryBuilder value) { return "(" + value.toString() + ")"; } private  Validator();   }
@Test public void sanitizeFieldAutoQuoteFieldNamesStar() { QueryBuilderOptions options = new QueryBuilderOptions(); options.autoQuoteFieldNames = true; String fieldName = "a.b.*"; String actual = Validator.sanitizeField(fieldName, options); String expected = "`a`.`b`.*"; assertEquals(expected, actual); }
@Test public void sanitizeFieldAutoQuoteFieldNamesIgnorePeriodsForFieldNameQuotes() { QueryBuilderOptions options = new QueryBuilderOptions(); options.autoQuoteFieldNames = true; options.ignorePeriodsForFieldNameQuotes = true; String fieldName = "a.b.c"; String actual = Validator.sanitizeField(fieldName, options); String expected = "`a.b.c`"; assertEquals(expected, actual); }
@Test public void sanitizeFieldAutoQuoteFieldNames() { QueryBuilderOptions options = new QueryBuilderOptions(); options.autoQuoteFieldNames = true; String fieldName = "a.b.c"; String actual = Validator.sanitizeField(fieldName, options); String expected = "`a`.`b`.`c`"; assertEquals(expected, actual); }