]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/test/BasicTestDefinition.java
refactor and clean of the distribution view model.
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / test / BasicTestDefinition.java
index 876a3e16397e214ab6b834912fe32a8a366176fe..6b92135e83cb119bd3584733684a6c5358064248 100644 (file)
@@ -1,7 +1,21 @@
+/*\r
+ * Copyright (C) 2007-2012 Argeo GmbH\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *         http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
 package org.argeo.slc.core.test;\r
 \r
 import org.argeo.slc.SlcException;\r
-import org.argeo.slc.core.structure.tree.TreeSRelatedHelper;\r
 import org.argeo.slc.core.test.context.ContextUtils;\r
 import org.argeo.slc.test.IncompatibleTestDataException;\r
 import org.argeo.slc.test.TestData;\r
@@ -12,14 +26,16 @@ import org.argeo.slc.test.TestStatus;
 import org.argeo.slc.test.context.ContextAware;\r
 \r
 /** Understands basic test data and context aware test data. */\r
-public class BasicTestDefinition extends TreeSRelatedHelper implements\r
-               TestDefinition {\r
+public class BasicTestDefinition implements TestDefinition {\r
 \r
        public void execute(TestRun testRun) {\r
                if (testRun.<TestData> getTestData() instanceof BasicTestData) {\r
                        BasicTestData testData = testRun.getTestData();\r
                        TestResult result = testRun.getTestResult();\r
 \r
+                       if (result == null)\r
+                               throw new SlcException("No test result defined.");\r
+\r
                        try {\r
                                if (testData.getExpected().equals(testData.getReached())) {\r
                                        result.addResultPart(new SimpleResultPart(\r
@@ -37,7 +53,7 @@ public class BasicTestDefinition extends TreeSRelatedHelper implements
                } else if (testRun.<TestData> getTestData() instanceof ContextAware) {\r
                        TestData testData = testRun.getTestData();\r
                        ContextUtils.compareReachedExpected((ContextAware) testData,\r
-                                       testRun.getTestResult(), this);\r
+                                       testRun.getTestResult());\r
                } else {\r
                        throw new IncompatibleTestDataException(testRun);\r
                }\r