/** * Verifies that the TestMatrix is compatible with all the required tests. Removes non-required * tests from the TestMatrix Replaces invalid or missing tests (buckets are not compatible) with * default implementation returning the fallback value see defaultFor * * @param testMatrix * @param matrixSource * @param requiredTests * @return */ public static ProctorLoadResult verifyAndConsolidate( @Nonnull final TestMatrixArtifact testMatrix, final String matrixSource, @Nonnull final Map<String, TestSpecification> requiredTests, @Nonnull final FunctionMapper functionMapper) { final ProctorLoadResult result = verify(testMatrix, matrixSource, requiredTests, functionMapper); final Map<String, ConsumableTestDefinition> definedTests = testMatrix.getTests(); // Remove any invalid tests so that any required ones will be replaced with default values // during the // consolidation below (just like missing tests). Any non-required tests can safely be ignored. for (final String invalidTest : result.getTestsWithErrors()) { // TODO - mjs - gross that this depends on the mutability of the returned map, but then so // does the // consolidate method below. definedTests.remove(invalidTest); } consolidate(testMatrix, requiredTests); return result; }