Example #1
0
 @Test
 public void testParseSQL_LineHasEnterChar() {
   String line =
       "insert into tdd_user(id,first_name,last_name,my_date,sarary)\n"
           + "values(3,'name\n3','last3','2011-03-20',2336);";
   String statement =
       "insert into tdd_user(id,first_name,last_name,my_date,sarary) values(3,'name\n3','last3','2011-03-20',2336)";
   String[] statments = DBHelper.parseSQL(line);
   want.array(statments).sizeEq(1);
   want.string(statments[0]).isEqualTo(statement);
 }
Example #2
0
 @Test
 public void testParseSQL_SINGLE_LINE_NOTE_REGEX() {
   String line =
       "insert into tdd_user(id,first_name,last_name,my_date,sarary)--本行注释\n"
           + "values(3,'name3','last3','2011-03-20',2336);";
   String[] statments = DBHelper.parseSQL(line);
   want.array(statments)
       .sizeEq(1)
       .hasItems(
           "insert into tdd_user(id,first_name,last_name,my_date,sarary) values(3,'name3','last3','2011-03-20',2336)");
 }
Example #3
0
 @Test
 public void testParseSQL_MULTI_LINE_NOTE_REGEX() {
   String line =
       "insert into tdd_user(id,first_name,last_name,my_date,sarary)\n"
           + "values(2,'name2','last2',/**插入注释**/'2011-03-19',2335);";
   String[] statments = DBHelper.parseSQL(line);
   want.array(statments)
       .sizeEq(1)
       .hasItems(
           "insert into tdd_user(id,first_name,last_name,my_date,sarary) values(2,'name2','last2','2011-03-19',2335)");
 }
Example #4
0
 @Test
 public void testParseSQL() throws FileNotFoundException {
   String lines = ResourceHelper.readFromFile("org/test4j/module/database/util/testParseSQL.sql");
   String[] statments = DBHelper.parseSQL(lines);
   want.array(statments).sizeEq(6);
 }