001    /*--------------------------------------------------------------------------+
002    $Id: TestletBase.java 26283 2010-02-18 11:18:57Z juergens $
003    |                                                                          |
004    | Copyright 2005-2010 Technische Universitaet Muenchen                     |
005    |                                                                          |
006    | Licensed under the Apache License, Version 2.0 (the "License");          |
007    | you may not use this file except in compliance with the License.         |
008    | You may obtain a copy of the License at                                  |
009    |                                                                          |
010    |    http://www.apache.org/licenses/LICENSE-2.0                            |
011    |                                                                          |
012    | Unless required by applicable law or agreed to in writing, software      |
013    | distributed under the License is distributed on an "AS IS" BASIS,        |
014    | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
015    | See the License for the specific language governing permissions and      |
016    | limitations under the License.                                           |
017    +--------------------------------------------------------------------------*/
018    package edu.tum.cs.commons.test;
019    
020    /**
021     * Base class for testlets. Testlets are junit test cases that are part of a
022     * test suite. We use them for smoke tests.
023     * <p>
024     * A testlet must pass the name of its test method to its base class in its
025     * constructor. This constraint comes from JUnit. It is easy to screw up!. This
026     * base class enforces this constraint, so its harder to violate it.
027     * <p>
028     * Deriving classes can be annotated with the attribute <code>Ignore</code> to
029     * tell the JUnit runner not to execute them outside a smoke test.
030     * (Unfortunately, the attribute does not get inherited, so it is not sufficient
031     * to annotate this class.)
032     * 
033     * @author juergens
034     * @author $Author: juergens $
035     * @version $Rev: 26283 $
036     * @levd.rating GREEN Hash: 1223984C9A6D6AA5FF32B1AAB9B537E4
037     */
038    public abstract class TestletBase extends CCSMTestCaseBase {
039    
040            /** Name of the method that gets called by JUnit */
041            private static final String TEST_METHOD_NAME = "test";
042    
043            /**
044             * Default constructor
045             */
046            protected TestletBase() {
047                    super(TEST_METHOD_NAME);
048            }
049    
050            /** Template method: Deriving classes override it with their test */
051            public abstract void test() throws Exception;
052    
053    }