use of org.eclipse.elk.core.data.LayoutAlgorithmData in project elk by eclipse.
the class LayoutTestRunner method initializeAlgorithms.
/**
* Loads all algorithms configured in the test class.
*/
private void initializeAlgorithms(final TestClass testClass, final List<Throwable> errors) {
testAlgorithms.addAll(TestAlgorithm.fromTestClass(testClass, errors));
// If we have whitebox tests, we need to check stuff
if (!whiteboxTests.isEmpty()) {
// Ensure that there is at least one specific layout algorithm
if (testAlgorithms.isEmpty() || testAlgorithms.get(0).getAlgorithmData() == null) {
errors.add(new Exception("Whitebox tests require explicit @Algorithm annotations."));
} else {
// Ensure that all algorithms are whitebox testable
for (TestAlgorithm algorithm : testAlgorithms) {
LayoutAlgorithmData algorithmData = algorithm.getAlgorithmData();
AbstractLayoutProvider layoutProvider = algorithmData.getInstancePool().fetch();
if (!(layoutProvider instanceof IWhiteBoxTestable)) {
errors.add(new Exception("Algorithm " + algorithmData.getId() + " is not whitebox testable."));
}
algorithmData.getInstancePool().release(layoutProvider);
}
}
}
if (testAlgorithms.isEmpty()) {
testAlgorithms.add(TestAlgorithm.identity());
}
}
Aggregations