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

org.conqat.engine.index.shared.tests.ETestExecutionResult Maven / Gradle / Ivy

There is a newer version: 2025.1.0-rc2
Show newest version
/*
 * Copyright (c) CQSE GmbH
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.conqat.engine.index.shared.tests;

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

/**
 * The result of a test execution. The order of the test executions is important
 * when determining the
 * {@link #worst(ETestExecutionResult, ETestExecutionResult)}
 * {@link ETestExecutionResult}. The order must be from best to worst in order
 * of definition in the {@link Enum} (i.e. highest ordinal is worst
 * {@link ETestExecutionResult}).
 */
@ExportToTypeScript
public enum ETestExecutionResult {

	/** Test execution was successful. */
	PASSED,

	/** The test is currently marked as "do not execute" (e.g. JUnit @Ignore). */
	IGNORED,

	/** Caused by a failing assumption. */
	SKIPPED,

	/** Caused by a failing assertion. */
	FAILURE,

	/** Caused by an error during test execution (e.g. exception thrown). */
	ERROR;

	/**
	 * To sum up all possible results in, e.g., parameter descriptions, a
	 * compile-time constant expression is needed. So we maintained manually a
	 * string representation of all possible results here.
	 */
	public static final String ALL_RESULTS = "PASSED, IGNORED, SKIPPED, FAILURE, ERROR";

	/** The best {@link ETestExecutionResult}. */
	public static final ETestExecutionResult BEST_RESULT = ETestExecutionResult.values()[0];

	/**
	 * Returns the worst {@link ETestExecutionResult} between the two
	 * {@link ETestExecutionResult}s.
	 */
	public static ETestExecutionResult worst(ETestExecutionResult resultA, ETestExecutionResult resultB) {
		if (resultA.ordinal() < resultB.ordinal()) {
			return resultB;
		}
		return resultA;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy