File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
src/test/java/net/sf/jsqlparser/expression/operators/relational Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 9
9
*/
10
10
package net .sf .jsqlparser .expression .operators .relational ;
11
11
12
+ import net .sf .jsqlparser .JSQLParserException ;
13
+ import net .sf .jsqlparser .expression .Expression ;
14
+ import net .sf .jsqlparser .expression .StringValue ;
15
+ import net .sf .jsqlparser .parser .CCJSqlParserUtil ;
12
16
import org .junit .jupiter .api .Test ;
13
17
14
18
import static org .junit .jupiter .api .Assertions .*;
@@ -27,10 +31,13 @@ public void testLikeNotIssue660() {
27
31
}
28
32
29
33
@ Test
30
- public void testSetEscapeAndGetStringExpression () {
31
- LikeExpression instance = new LikeExpression ();
32
- LikeExpression instance2 = new LikeExpression ();
34
+ public void testSetEscapeAndGetStringExpression () throws JSQLParserException {
35
+ LikeExpression instance = (LikeExpression ) CCJSqlParserUtil .parseExpression ("name LIKE 'J%$_%'" );
36
+ // escape character should be $
37
+ Expression instance2 = new StringValue ("$" );
33
38
instance .setEscape (instance2 );
34
- assertEquals ("null LIKE null ESCAPE null LIKE null" , instance .toString ());
39
+
40
+ // match all records with names that start with letter ’J’ and have the ’_’ character in them
41
+ assertEquals ("name LIKE 'J%$_%' ESCAPE '$'" , instance .toString ());
35
42
}
36
43
}
You can’t perform that action at this time.
0 commit comments