X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=inline;f=org.argeo.slc.spring%2Fsrc%2Forg%2Fargeo%2Fslc%2Fcore%2Ftest%2FBasicTestDefinition.java;fp=org.argeo.slc.spring%2Fsrc%2Forg%2Fargeo%2Fslc%2Fcore%2Ftest%2FBasicTestDefinition.java;h=0000000000000000000000000000000000000000;hb=dfac3414a612edd63eaaf8568ddc80271707af22;hp=6b92135e83cb119bd3584733684a6c5358064248;hpb=c10c30a727b8f3bce64c0c347a08c111845a3da2;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.spring/src/org/argeo/slc/core/test/BasicTestDefinition.java b/org.argeo.slc.spring/src/org/argeo/slc/core/test/BasicTestDefinition.java deleted file mode 100644 index 6b92135e8..000000000 --- a/org.argeo.slc.spring/src/org/argeo/slc/core/test/BasicTestDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.test.context.ContextUtils; -import org.argeo.slc.test.IncompatibleTestDataException; -import org.argeo.slc.test.TestData; -import org.argeo.slc.test.TestDefinition; -import org.argeo.slc.test.TestResult; -import org.argeo.slc.test.TestRun; -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 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( - TestStatus.PASSED, "Reached and expected equals")); - } else { - result.addResultPart(new SimpleResultPart( - TestStatus.FAILED, "Expected " - + testData.getExpected() + " but reached " - + testData.getReached())); - } - } catch (Exception e) { - result.addResultPart(new SimpleResultPart(TestStatus.ERROR, - "Could not compare", e)); - } - } else if (testRun. getTestData() instanceof ContextAware) { - TestData testData = testRun.getTestData(); - ContextUtils.compareReachedExpected((ContextAware) testData, - testRun.getTestResult()); - } else { - throw new IncompatibleTestDataException(testRun); - } - } -}