File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
src/test/java/net/sf/jsqlparser/expression/operators/relational Expand file tree Collapse file tree 1 file changed +17
-2
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 static org .junit .jupiter .api .Assertions .assertFalse ;
13
- import static org .junit .jupiter .api .Assertions .assertTrue ;
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 ;
14
16
import org .junit .jupiter .api .Test ;
15
17
18
+ import static org .junit .jupiter .api .Assertions .*;
19
+
16
20
/**
17
21
*
18
22
* @author Tobias Warneke (t.warneke@gmx.net)
@@ -25,4 +29,15 @@ public void testLikeNotIssue660() {
25
29
assertFalse (instance .isNot ());
26
30
assertTrue (instance .withNot (true ).isNot ());
27
31
}
32
+
33
+ @ Test
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 ("$" );
38
+ instance .setEscape (instance2 );
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 ());
42
+ }
28
43
}
You can’t perform that action at this time.
0 commit comments