Kaydet (Commit) 4e1a015d authored tarafından Noel Grandin's avatar Noel Grandin

convert runState to a proper enum

Change-Id: I6f74e597fe9834b18023e73ee8b8bf50d10c82e2
üst cb2c4d77
......@@ -83,6 +83,7 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/runner/lib/ExceptionStatus \
qadevOOo/runner/lib/MultiMethodTest \
qadevOOo/runner/lib/MultiPropertyTest \
qadevOOo/runner/lib/RunState \
qadevOOo/runner/lib/SimpleStatus \
qadevOOo/runner/lib/Status \
qadevOOo/runner/lib/StatusException \
......
......@@ -29,7 +29,7 @@ class ExceptionStatus extends Status {
* @param t the exception an activity terminated with.
*/
ExceptionStatus( Throwable t ) {
super(EXCEPTION, FAILED);
super(RunState.EXCEPTION, FAILED);
String message = t.getMessage();
if (message != null)
runStateString = message;
......
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you 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 .
*/
package lib;
public enum RunState {
/**
* The constant represents PASSED runtime state.
*/
PASSED,
/**
* The constant represents EXCEPTION runtime state.
*/
EXCEPTION,
/**
* The constant represents SKIPPED runtime state.
*/
SKIPPED,
/**
* This is a private indicator for a user defined runtime state
*/
USER_DEFINED
}
......@@ -24,27 +24,6 @@ package lib;
* the SimpleSTatus instance.
*/
class SimpleStatus {
/* Run states. */
/**
* The constatnt represents PASSED runtime state.
*/
public static final int PASSED = 0;
/**
* The constant represents EXCEPTION runtime state.
*/
public static final int EXCEPTION = 3;
/**
* The constant represents SKIPPED runtime state.
*/
public static final int SKIPPED = 1;
/**
* This is a private indicator for a user defined runtime state
*/
private static final int USER_DEFINED = 4;
/* Test states */
......@@ -63,7 +42,7 @@ class SimpleStatus {
/**
* The field is holding reason of the status.
*/
private final int runState;
private final RunState runState;
/**
* This is the run state: either SKIPPED, PASSED, etc.
......@@ -74,14 +53,14 @@ class SimpleStatus {
/**
* The constructor initialize state and reason field.
*/
protected SimpleStatus( int runState, boolean state ) {
protected SimpleStatus( RunState runState, boolean state ) {
this.state = state;
this.runState = runState;
if ( runState == PASSED ) {
if ( runState == RunState.PASSED ) {
runStateString = "PASSED";
} else if ( runState == SKIPPED ) {
} else if ( runState == RunState.SKIPPED ) {
runStateString = "SKIPPED";
} else if ( runState == EXCEPTION ) {
} else if ( runState == RunState.EXCEPTION ) {
runStateString = "EXCEPTION";
} else {
runStateString = "UNKNOWN";
......@@ -93,7 +72,7 @@ class SimpleStatus {
*/
protected SimpleStatus(String runStateString, boolean state) {
this.state = state;
this.runState = USER_DEFINED;
this.runState = RunState.USER_DEFINED;
this.runStateString = runStateString;
}
......@@ -107,7 +86,7 @@ class SimpleStatus {
/**
* getRunState() implementation. Just returns th runState field value.
*/
public int getRunState() {
public RunState getRunState() {
return runState;
}
......
......@@ -41,7 +41,7 @@ public class Status extends SimpleStatus {
* @param runState either PASSED, SKIPPED, etc.
* @param state OK or FAILED.
*/
public Status(int runState, boolean state ) {
public Status(RunState runState, boolean state ) {
super(runState, state);
}
......@@ -62,7 +62,7 @@ public class Status extends SimpleStatus {
* otherwise).
*/
public static Status passed( boolean state ) {
return new Status(PASSED, state );
return new Status(RunState.PASSED, state );
}
/**
......@@ -83,7 +83,7 @@ public class Status extends SimpleStatus {
* otherwise).
*/
public static Status skipped( boolean state ) {
return new Status( SKIPPED, state );
return new Status( RunState.SKIPPED, state );
}
......@@ -115,7 +115,7 @@ public class Status extends SimpleStatus {
* Checks whether the status runstate is passed.
*/
public boolean isPassed() {
return getRunState() == PASSED;
return getRunState() == RunState.PASSED;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment