Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xwiki-platform
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XWiki
xwiki-platform
Commits
00026f72
Commit
00026f72
authored
3 years ago
by
Vincent Massol
Browse files
Options
Downloads
Patches
Plain Diff
[Misc] Convert test to JUnit5 + improve test quality to verify that it parsed correctly the input
parent
7cc914e4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xwiki-platform-core/xwiki-platform-query/xwiki-platform-query-jpql-parser/src/test/java/org/xwiki/query/jpql/internal/JPQLParserTest.java
+19
-15
19 additions, 15 deletions
...st/java/org/xwiki/query/jpql/internal/JPQLParserTest.java
with
19 additions
and
15 deletions
xwiki-platform-core/xwiki-platform-query/xwiki-platform-query-jpql-parser/src/test/java/org/xwiki/query/jpql/internal/JPQLParserTest.java
+
19
−
15
View file @
00026f72
...
...
@@ -19,22 +19,22 @@
*/
package
org.xwiki.query.jpql.internal
;
import
org.junit.Test
;
import
org.junit.jupiter.api.Test
;
import
org.xwiki.query.internal.jpql.node.Start
;
public
class
JPQLParserTest
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
/**
* Unit tests for {@link JPQLParser}.
*
* @version $Id$
*/
class
JPQLParserTest
{
private
JPQLParser
parser
=
new
JPQLParser
();
@Test
public
void
testStartSpeed
()
throws
Exception
{
// heat up parser engine for more accuracy test timing
// this is needed because of much static data in the parser
parser
.
parse
(
"select a from A as a"
);
}
@Test
public
void
testJPQL
()
throws
Exception
void
parseVariousJPQL
()
throws
Exception
{
// quotes
parser
.
parse
(
"select a from A as a where a.f='str'"
);
...
...
@@ -58,7 +58,7 @@ public void testJPQL() throws Exception
}
@Test
public
void
test
XWQLExtensions
()
throws
Exception
void
parse
XWQLExtensions
()
throws
Exception
{
// object() in from clause
parser
.
parse
(
"select doc from Document as doc, doc.object('XWiki.Test') as test where test.some=1"
);
...
...
@@ -70,11 +70,15 @@ public void testXWQLExtensions() throws Exception
}
@Test
public
void
parseMethodsInLike
()
throws
Exception
void
parseMethodsInLike
()
throws
Exception
{
this
.
parser
.
parse
(
"SELECT doc.fullName FROM Document doc, doc.object(XWiki.XWikiUsers) obj "
Start
result
=
this
.
parser
.
parse
(
"SELECT doc.fullName FROM Document doc, doc.object(XWiki.XWikiUsers) obj "
+
"where obj.first_name like LOWER('%DMIN%')"
);
this
.
parser
.
parse
(
"SELECT doc.fullName FROM Document doc, doc.object(XWiki.XWikiUsers) obj "
assertEquals
(
"SELECT doc.fullName FROM Document doc , doc.object ( XWiki.XWikiUsers ) obj where "
+
"obj.first_name like LOWER ( '%DMIN%' ) "
,
result
.
toString
());
result
=
this
.
parser
.
parse
(
"SELECT doc.fullName FROM Document doc, doc.object(XWiki.XWikiUsers) obj "
+
"where obj.first_name like LOWER(CONCAT('%', 'DMIN%'))"
);
assertEquals
(
"SELECT doc.fullName FROM Document doc , doc.object ( XWiki.XWikiUsers ) obj where "
+
"obj.first_name like LOWER ( CONCAT ( '%' , 'DMIN%' ) ) "
,
result
.
toString
());
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment