001/*-------------------------------------------------------------------------+ 002| | 003| Copyright (c) 2005-2018 The ConQAT Project | 004| | 005| Licensed under the Apache License, Version 2.0 (the "License"); | 006| you may not use this file except in compliance with the License. | 007| You may obtain a copy of the License at | 008| | 009| http://www.apache.org/licenses/LICENSE-2.0 | 010| | 011| Unless required by applicable law or agreed to in writing, software | 012| distributed under the License is distributed on an "AS IS" BASIS, | 013| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 014| See the License for the specific language governing permissions and | 015| limitations under the License. | 016| | 017+-------------------------------------------------------------------------*/ 018package org.conqat.engine.index.shared.tests; 019 020/** 021 * The result of a test execution. The order of the test executions is important 022 * when determining the 023 * {@link #worst(ETestExecutionResult, ETestExecutionResult)} 024 * {@link ETestExecutionResult}. The order must be from best to worst in order 025 * of definition in the {@link Enum} (i.e. highest ordinal is worst 026 * {@link ETestExecutionResult}). 027 */ 028public enum ETestExecutionResult { 029 030 /** Test execution was successful. */ 031 PASSED, 032 033 /** The test is currently marked as "do not execute" (e.g. JUnit @Ignore). */ 034 IGNORED, 035 036 /** Caused by a failing assumption. */ 037 SKIPPED, 038 039 /** Caused by a failing assertion. */ 040 FAILURE, 041 042 /** Caused by an error during test execution (e.g. exception thrown). */ 043 ERROR; 044 045 /** The best {@link ETestExecutionResult}. */ 046 public static final ETestExecutionResult BEST_RESULT = ETestExecutionResult.values()[0]; 047 048 /** 049 * Returns the worst {@link ETestExecutionResult} between the two 050 * {@link ETestExecutionResult}s. 051 */ 052 public static ETestExecutionResult worst(ETestExecutionResult resultA, ETestExecutionResult resultB) { 053 if (resultA.ordinal() < resultB.ordinal()) { 054 return resultB; 055 } 056 return resultA; 057 } 058}