package com.opera.core.systems.scope.services;

import java.util.List;

public interface ISelftest {
	/**
	 * Run the selftests for the specified modules.
	 *
	 * @param modules The names of the modules to test
	 * @return The test output
	 */
	public void runSelftests(List<String> modules);

	public class SelftestResult {
		private String tag;
		private String description;
		private ResultType result;
		private String skipWhy;

		public SelftestResult(String tag, String description, ResultType result) {
			this(tag, description, result, null);
		}

		public SelftestResult(String tag, String description, ResultType result, String reason) {
			if(reason != null && result != ResultType.SKIP)
				throw new IllegalArgumentException("SKIP reason not allowed with non-SKIP result.");

			this.tag = tag;
			this.description = description;
			this.result = result;
			skipWhy = reason;
		}

		public String getTag()         { return tag; }
		public String getDescription() { return description; }
		public ResultType getResult()  { return result; }
		public String getSkipWhy()     { return skipWhy; }

		public String toString() {
			String format;
			Object[] args;
			if(skipWhy != null) {
				format = "%s:%s\t%s\t%s";
				args = new Object[]{tag, description, result, skipWhy};
			}
			else {
				format = "%s:%s\t%s";
				args = new Object[]{tag, description, result};
			}

			return String.format(format, args);
		}
	}

	public enum ResultType {
		PASS, FAIL, SKIP
	}
}

@@ -416,23 +416,20 @@
  String 
-skipWhy
+more
 ;%0A%0A%09%09pub
@@ -632,158 +632,15 @@
 ing 
-reason) %7B%0A%09%09%09if(reason != null && result != ResultType.SKIP)%0A%09%09%09%09throw new IllegalArgumentException(%22SKIP reason not allowed with non-SKIP result.%22);%0A
+more) %7B
 %0A%09%09%09
@@ -722,24 +722,24 @@
 %0A%09%09%09
-skipWhy = reason
+this.more = more
 ;%0A%09%09
@@ -922,22 +922,22 @@
  get
-SkipWhy()
+More()  
      
+ 
 %7B re
@@ -941,23 +941,20 @@
  return 
-skipWhy
+more
 ; %7D%0A%0A%09%09p
@@ -1021,23 +1021,20 @@
 ;%0A%09%09%09if(
-skipWhy
+more
  != null
@@ -1121,15 +1121,12 @@
 lt, 
-skipWhy
+more
 %7D;%0A%09

Rename skipwhy to more, and allow it for all results (it's also used for FAILs).