summaryrefslogtreecommitdiff
path: root/qadevOOo
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-10-16 10:55:02 +0200
committerNoel Grandin <noel@peralex.com>2015-10-16 10:56:05 +0200
commit14bf708ef586b15dffed66ffaf524baf4d8fcbfa (patch)
tree5873a9a3fd7bf6189c3f1fb4aba3916884738de2 /qadevOOo
parenta3a89c15230317710ba32753c0eafdb4733730ef (diff)
convert "continue" flag to an enum
Change-Id: I160de1152978f301c514d9107c9e9082bab3cf05
Diffstat (limited to 'qadevOOo')
-rw-r--r--qadevOOo/runner/complexlib/Assurance.java29
1 files changed, 16 insertions, 13 deletions
diff --git a/qadevOOo/runner/complexlib/Assurance.java b/qadevOOo/runner/complexlib/Assurance.java
index d3c98e38f41a..4fbf3755d64f 100644
--- a/qadevOOo/runner/complexlib/Assurance.java
+++ b/qadevOOo/runner/complexlib/Assurance.java
@@ -24,7 +24,10 @@ package complexlib;
*/
public class Assurance
{
- public static final boolean CONTINUE = true;
+ /** Used to indicate that we should continue with test method, even if check fails */
+ public enum ContinueWithTest {
+ YES, NO
+ }
/** State of the current test method **/
protected boolean bSuccessful = true;
@@ -39,7 +42,7 @@ public class Assurance
* @param s The condition that should be true.
*/
protected void assure(boolean s) {
- assure("Assure failed.", s, false);
+ assure("Assure failed.", s, ContinueWithTest.NO);
}
/**
@@ -49,7 +52,7 @@ public class Assurance
* @param s The condition that should be true.
*/
protected void assure(String msg, boolean s) {
- assure(msg, s, false);
+ assure(msg, s, ContinueWithTest.NO);
}
/**
@@ -59,7 +62,7 @@ public class Assurance
* @param actual specifies the actual int value
*/
protected void assureEquals( String message, int expected, int actual ) {
- assureEquals( message, Integer.valueOf( expected ), Integer.valueOf( actual ), false );
+ assureEquals( message, Integer.valueOf( expected ), Integer.valueOf( actual ), ContinueWithTest.NO );
}
/**
@@ -69,13 +72,13 @@ public class Assurance
* @param actual specifies the actual string value
*/
protected void assureEquals( String message, String expected, String actual ) {
- assureEquals( message, expected, actual, false );
+ assureEquals( message, expected, actual, ContinueWithTest.NO );
}
/**
* assures the two given sequences are of equal length, and have equal content
*/
- public <T> void assureEquals( String i_message, T[] i_expected, T[] i_actual, boolean i_continue )
+ public <T> void assureEquals( String i_message, T[] i_expected, T[] i_actual, ContinueWithTest i_continue )
{
if ( i_expected.length != i_actual.length )
failed( i_message + ": expected element count: " + i_expected.length + ", actual element count: " + i_actual.length );
@@ -91,7 +94,7 @@ public class Assurance
* @param msg The message of the failure.
*/
protected void failed(String msg) {
- assure(msg, false, false);
+ assure(msg, false, ContinueWithTest.NO);
}
/**
@@ -103,19 +106,19 @@ public class Assurance
* The current method will of course marked as failed.
* @param msg The message that is evaluated.
* @param s The condition that should be true.
- * @param cont Continue with test method, even if s is false.
+ * @param cont if YES, continue with test method, even if s is false.
*/
- protected void assure(String msg, boolean s, boolean cont) {
+ protected void assure(String msg, boolean s, ContinueWithTest cont) {
bSuccessful &= s;
if (!s) {
message += msg + "\r\n";
- if (!cont) {
+ if (cont == ContinueWithTest.NO) {
throw new AssureException(msg);
}
}
}
- private void assureEquals( String message, Object expected, Object actual, boolean cont ) {
+ private void assureEquals( String message, Object expected, Object actual, ContinueWithTest cont ) {
assure( message + " (expected: " + expected.toString() + ", actual: " + actual.toString() + ")",
expected.equals( actual ), cont );
}
@@ -128,9 +131,9 @@ public class Assurance
* method will continue.<br>
* The current method will of course marked as failed.
* @param msg The message that is evaluated.
- * @param cont Continue with test method, even if s is false.
+ * @param cont if YES, continue with test method, even if s is false.
*/
- protected void failed(String msg, boolean cont) {
+ protected void failed(String msg, ContinueWithTest cont) {
assure(msg, false, cont);
}