[MAGNOLIA-8021] ComponentsTestUtil should allow to use an extension of MockComponentProvider Created: 13/Oct/16  Updated: 08/Mar/21  Resolved: 08/Mar/21

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

Type: Improvement Priority: Major
Reporter: Daniel Kasmeroglu Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Java Source File ExtendedComponentsTestUtil.java    
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)
Date of First Response:

 Description   

In order to simplify/improve testing the ComponentsTestUtil class should allow to use an alternative class instead of MockComponentProvider. This is currently not possible in a nice way as everything is static and doesn't allow to be extended.

It would be nice to be able to override this implementation. The attached extension (only meant to be a suggestion) does this using reflections. In essence it's just adding the possibility to configure the MockProvider extension class.



 Comments   
Comment by Daniel Kasmeroglu [ 13/Oct/16 ]

I've obviously chosen the wrong project but I don't have the rights to change the project, so I only can apologize for that.

Comment by Roman Kovařík [ 08/Mar/21 ]

Closing as it should be possible to set component provider by

        ComponentsTestUtil.setInstance(ComponentProvider.class, new MockSimpleComponentProvider());
Generated at Mon Feb 12 04:28:55 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.