[MAGNOLIA-3479] ContentUtil: orderAfter does not work propertly Created: 21/Dec/10  Updated: 09/Oct/12  Resolved: 05/Jan/11

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 4.3.8, 4.4.1
Fix Version/s: 4.3.9, 4.4.2, 4.5

Type: Bug Priority: Major
Reporter: Christian Ringele Assignee: Ondrej Chytil
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File ContentUtilTest.java.patch     File ContentUtilTest.java.patch2    
Template:
Patch included:
Yes
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Testcase included:
Yes
Date of First Response:

 Description   

The algorithm can't work, it just orders all nodes in front of the 'nodeToMove' until the 'targetNodeName' is in front. But that can't work in most cases (at least when there is more than three nodes as in the existing textcase).

I created a patch with test cases, all these should work properly (ContentUtilTest.java.patch).
While testing the orderAfter i tested the orderBefore too.
The orderBefore works fine, still adding a patch here, so the test cases (no cases there yet) can be added&tested at the same time (ContentUtilTest.java.patch2).



 Comments   
Comment by Magnolia International [ 21/Dec/10 ]

Patches look good; little tip: extract common logic out of your test for readability (i.e the bits where a collection of nodes is transformed in an List<String>

Tip (2) Arrays.asList(new String[]{"b", "c","a"}) can be written as Arrays.asList("b", "c", "a"), an further shortened with asList("b", "c", "a") if you import static java.util.Arrays.asList

Generated at Mon Feb 12 03:46:52 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.