Serial: support for anonymous inner classes
[nikiroo-utils.git] / src / be / nikiroo / utils / test / TestCase.java
index 4e7d3800c5a588bf6a1b06f341bfc5d3c2c8c2ac..0479370f64df57bc5e27a809ee706b0908005f85 100644 (file)
@@ -38,6 +38,15 @@ abstract public class TestCase {
                this.name = name;
        }
 
+       /**
+        * This constructor can be used if you require a no-param constructor. In
+        * this case, you are allowed to set the name manually via
+        * {@link TestCase#setName}.
+        */
+       protected TestCase() {
+               this("no name");
+       }
+
        /**
         * Setup the test (called before the test is run).
         * 
@@ -65,6 +74,20 @@ abstract public class TestCase {
                return name;
        }
 
+       /**
+        * The test name.
+        * 
+        * @param name
+        *            the new name (internal use only)
+        * 
+        * @return this (so we can chain and so we can initialize it in a member
+        *         variable if this is an anonymous inner class)
+        */
+       protected TestCase setName(String name) {
+               this.name = name;
+               return this;
+       }
+
        /**
         * Actually do the test.
         *