Added tests for the TCK itself.

git-svn-id: https://atinject.googlecode.com/svn/trunk@34 3bc8319c-20ab-11de-9edc-3f40a397ab60
diff --git a/tck/com/googlecode/atinject/Tck.java b/tck/com/googlecode/atinject/Tck.java
index 1bbb31e..6aa86ac 100644
--- a/tck/com/googlecode/atinject/Tck.java
+++ b/tck/com/googlecode/atinject/Tck.java
@@ -22,6 +22,7 @@
 import junit.framework.Test;
 import junit.framework.TestResult;
 import junit.framework.TestSuite;
+import junit.framework.TestCase;
 
 /**
  * Extend this class, implement {@link #getCar()}, and declare a static
@@ -66,7 +67,7 @@
         if (!(car instanceof Convertible)) {
             delegate = new Failure(
                     "getCar() did not return an instance of Convertible",
-                    new ClassCastException("Expected: Convertible, got: "
+                    new ClassCastException("Expected Convertible, got "
                             + car.getClass().getName()));
             return;
         }
@@ -107,23 +108,24 @@
      */
     protected abstract Car getCar();
 
-    static class Failure implements Test {
-        final String message;
+    static class Failure extends TestCase {
+        /*
+         * We have to extend TestCase instead of implementing Test so we
+         * can set the name.
+         */
+
         final Throwable t;
-        Failure(String message, Throwable t) {
-            this.message = message;
+        Failure(String name, Throwable t) {
+            setName(name);
             this.t = t;
         }
-        public int countTestCases() {
+        @Override public int countTestCases() {
             return 1;
         }
-        public void run(TestResult result) {
+        @Override public void run(TestResult result) {
             result.startTest(this);
             result.addError(this, t);
             result.endTest(this);
         }
-        @Override public String toString() {
-            return message;
-        }
     }
 }
diff --git a/tck/com/googlecode/atinject/meta/BrokenGetCar.java b/tck/com/googlecode/atinject/meta/BrokenGetCar.java
new file mode 100644
index 0000000..689bc95
--- /dev/null
+++ b/tck/com/googlecode/atinject/meta/BrokenGetCar.java
@@ -0,0 +1,41 @@
+package com.googlecode.atinject.meta;
+
+import com.googlecode.atinject.Tck;
+import com.googlecode.atinject.Tester;
+import com.googlecode.atinject.auto.Car;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class BrokenGetCar {
+
+    static class ThrowsException extends Tck {
+        protected Car getCar() {
+            throw new UnsupportedOperationException();
+        }
+    }
+
+    static class ReturnsNull extends Tck {
+        protected Car getCar() {
+            return null;
+        }
+    }
+
+    static class WrongType extends Tck {
+        protected Car getCar() {
+            return new Car() {
+                public void check(Tester tester) {
+                    throw new UnsupportedOperationException();
+                }
+            };
+        }
+    }
+
+    public static Test suite() {
+        TestSuite suite = new TestSuite();
+        suite.addTest(new ThrowsException());
+        suite.addTest(new ReturnsNull());
+        suite.addTest(new WrongType());
+        return suite;
+    }
+}