X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.core%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Ftest%2FBasicTestDefinition.java;h=6b92135e83cb119bd3584733684a6c5358064248;hb=6867e7eef2de759cf14fabe575fcba0bea29d6fc;hp=876a3e16397e214ab6b834912fe32a8a366176fe;hpb=ee6c3543a0ff9403420ce6a9c647723269f14331;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/test/BasicTestDefinition.java b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/test/BasicTestDefinition.java index 876a3e163..6b92135e8 100644 --- a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/test/BasicTestDefinition.java +++ b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/test/BasicTestDefinition.java @@ -1,7 +1,21 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.argeo.slc.core.test; import org.argeo.slc.SlcException; -import org.argeo.slc.core.structure.tree.TreeSRelatedHelper; import org.argeo.slc.core.test.context.ContextUtils; import org.argeo.slc.test.IncompatibleTestDataException; import org.argeo.slc.test.TestData; @@ -12,14 +26,16 @@ import org.argeo.slc.test.TestStatus; import org.argeo.slc.test.context.ContextAware; /** Understands basic test data and context aware test data. */ -public class BasicTestDefinition extends TreeSRelatedHelper implements - TestDefinition { +public class BasicTestDefinition implements TestDefinition { public void execute(TestRun testRun) { if (testRun. getTestData() instanceof BasicTestData) { BasicTestData testData = testRun.getTestData(); TestResult result = testRun.getTestResult(); + if (result == null) + throw new SlcException("No test result defined."); + try { if (testData.getExpected().equals(testData.getReached())) { result.addResultPart(new SimpleResultPart( @@ -37,7 +53,7 @@ public class BasicTestDefinition extends TreeSRelatedHelper implements } else if (testRun. getTestData() instanceof ContextAware) { TestData testData = testRun.getTestData(); ContextUtils.compareReachedExpected((ContextAware) testData, - testRun.getTestResult(), this); + testRun.getTestResult()); } else { throw new IncompatibleTestDataException(testRun); }