Exemplo n.º 1
0
 @Test
 public void diffline() {
   String[][] tests = {
     {
       "\"(ses_id, mer_id, pass_id, \" + refCol +\" , mer_ref, amnt, "
           + "cur, ps_id, ret_url, d_req_time, d_req_mil, h_resp_time, "
           + "h_resp_mil) \"",
       "\"(ses_id, mer_id, pass_id, \" + refCol +\" , mer_ref, amnt, "
           + "cur, ps_id, ret_url, exp_url, d_req_time, d_req_mil, "
           + "h_resp_time, h_resp_mil) \"",
       "\"(ses_id, mer_id, pass_id, \" + refCol +\" , mer_ref, amnt, "
           + "cur, ps_id, ret_url, <span class=\"a\">exp_url, "
           + "</span>d_req_time, d_req_mil, h_resp_time, h_resp_mil) \""
     },
     {
       "\"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\", values);",
       "\"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\", values);",
       "\"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?<span "
           + "class=\"a\">, ?</span>)\", values);"
     },
     {
       "char    *config_list = NULL;",
       "char    **config_list = NULL;",
       "char    *<span class=\"a\">*</span>config_list = NULL;"
     },
     {
       "* An error occured or there is non-numeric stuff at the end",
       "* An error occurred or there is non-numeric stuff at the end",
       "* An error occur<span class=\"a\">r</span>ed or there is " + "non-numeric stuff at the end"
     }
   };
   for (int i = 0; i < tests.length; i++) {
     String[] strings =
         Util.diffline(new StringBuilder(tests[i][0]), new StringBuilder(tests[i][1]));
     assertEquals("" + i + "," + 0, strings[0], tests[i][0]);
     assertEquals("" + i + "," + 1, strings[1], tests[i][2]);
   }
 }