All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.teamscale.service.testimpact.prioritization.ETestSelectionReason Maven / Gradle / Ivy

The newest version!
package com.teamscale.service.testimpact.prioritization;

import java.util.function.Predicate;

import org.conqat.lib.commons.js_export.ExportToTypeScript;

/**
 * Reason that a test case was selected by the test impact analysis.
 */
@ExportToTypeScript
public enum ETestSelectionReason {

	/** Test covers added or changed code. */
	COVERS_CHANGES("Impacted", "blue"),

	/** Test did cover code that has been removed. */
	COVERS_DELETED("Impacted", "blue"),

	/** Test was added or modified. */
	ADDED_OR_MODIFIED_TEST("New or changed", "orange"),

	/** Test was failed or errored. */
	PREVIOUSLY_FAILED("Failed", "red"),

	/** Test was skipped or ignored. */
	PREVIOUSLY_SKIPPED("Skipped", "grey"),

	/** Test covers no changes. */
	COVERS_OTHER("Not impacted", "grey");

	/** Human readable name for the selection reason. */
	public final String readableName;

	/**
	 * The class name of the css class used as background for the impacted test entry.
	 */
	public final String cssColorClass;

	ETestSelectionReason(String readableName, String cssColorClass) {
		this.readableName = readableName;
		this.cssColorClass = cssColorClass;
	}

	public String getReadableName() {
		return readableName;
	}

	/**
	 * Creates a {@link Predicate} which matches if any of the selection reasons of
	 * {@link IPrioritizableTests#getSelectionReasons()} match te given test selection reason.
	 */
	public static Predicate containsAnyFilter(ETestSelectionReason testSelectionReason) {
		return test -> test.getSelectionReasons().stream().anyMatch(testSelectionReason::equals);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy