[MAGNOLIA-8111] Error in MockQueryResult when camelCase nodetypes Created: 03/Jun/21  Updated: 20/Dec/21  Resolved: 17/Dec/21

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 6.2.9
Fix Version/s: 6.2.15

Type: Bug Priority: Neutral
Reporter: Jonathan Ayala Assignee: Thuy To
Resolution: Fixed Votes: 0
Labels: maintenance
Remaining Estimate: Not Specified
Time Spent: 1d 1h
Original Estimate: Not Specified

Issue Links:
causality
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Sprint: Global Maintenance 3
Story Points: 2

 Description   

Steps to reproduce

  • Create a MockSession
  • Create MockNodes with a camelCase primary node type (e.g. mgnl:contentNode)
  • Query for the nodes (select * from [mgnl:contentNode])

Expected results

MockQueryResult returns a collection of nodes

Actual results

MockQueryResult result is empty

Development notes

The problem is in the constructor of MockQueryResult as it lowercases the passed statement and thus, the camelcase node type.

info.magnolia.test.mock.jcr.MockQueryResult line 60
this.type = StringUtils.substringBefore(StringUtils.substringAfter(statement.toLowerCase(), " from "), " where ").trim();

Generated at Mon Feb 12 04:29:45 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.