1 /*
2 * Copyright 2005 Werner Guttmann
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.codehaus.castor.maven.xmlctf;
17
18 import junit.framework.Test;
19 import junit.framework.TestResult;
20 import junit.textui.TestRunner;
21
22 import org.apache.maven.plugin.MojoExecutionException;
23
24 /**
25 * Uses a simple junit.ui.TestRunner TextRunner to run the XMLCTF test suite.
26 *
27 * @goal xmlctf-text
28 * @since 1.2
29 */
30 public class TextTestSuiteMojo extends AbstractTestSuiteMojo {
31
32 /**
33 * {@inheritDoc}
34 *
35 * @see org.codehaus.castor.maven.xmlctf.AbstractTestSuiteMojo#runJUnit(junit.framework.Test)
36 */
37 public void runJUnit(Test testSuite) throws MojoExecutionException {
38 TestResult result = TestRunner.run(testSuite);
39
40 if (result.errorCount() > 0 || result.failureCount() > 0) {
41 throw new MojoExecutionException(
42 "Errors or Failures occured testing the MasterTestSuite!");
43 }
44 }
45
46 }