Skip to content

Introduce API for ordering test descriptor children in place #4290

@mpkorstanje

Description

@mpkorstanje

Currently, it is not possible to order children without first removing all children and then adding them back in order. E.g:

var children = new ArrayList<>(testDescriptor.getChildren());
Collections.shuffle(children);
children.forEach(testDescriptor::removeChild);
children.forEach(testDescriptor::addChild);

By adding orderChildren(UnaryOperator<List<TestDescriptor>> orderer) would become possible to write:

testDescriptor.orderChildren(children -> {
	Collections.shuffle(children);
	return children;
});

I've made #4289 to explore this solution.

And I found two items worth discussing:

  • TestDescriptor is an interface, adding a method requires a sensible default. What should that default be?
  • Should that default implementation be functional, because TestDescriptor is an interface a default implementation must still use removeChild and addChild. Is it necessary to add a more optimized implementation in AbstractTestDescriptor?

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions