|
|
@ -38,4 +38,24 @@ public class AbstractTaskTest { |
|
|
|
Assertions.assertEquals(jobId, str.substring(6)); |
|
|
|
Assertions.assertEquals(jobId, str.substring(6)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testSetValue() { |
|
|
|
|
|
|
|
Pattern SETVALUE_REGEX = Pattern.compile(TaskConstants.SETVALUE_REGEX); |
|
|
|
|
|
|
|
String line1 = "${setValue(sql=\"INSERT INTO a VALUES (1, 2);\")}"; |
|
|
|
|
|
|
|
String line2 = "${setValue(a=2))}"; |
|
|
|
|
|
|
|
Matcher matcher1 = SETVALUE_REGEX.matcher(line1); |
|
|
|
|
|
|
|
String str1 = null; |
|
|
|
|
|
|
|
if (matcher1.find()) { |
|
|
|
|
|
|
|
str1 = matcher1.group(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String str2 = null; |
|
|
|
|
|
|
|
Matcher matcher2 = SETVALUE_REGEX.matcher(line2); |
|
|
|
|
|
|
|
if (matcher2.find()) { |
|
|
|
|
|
|
|
str2 = matcher2.group(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Assertions.assertNotNull(str1); |
|
|
|
|
|
|
|
Assertions.assertNotNull(str2); |
|
|
|
|
|
|
|
Assertions.assertEquals(str1.length(), line1.length()); |
|
|
|
|
|
|
|
Assertions.assertEquals(str2.length(), line2.length()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|