View Javadoc

1   /*
2    * Copyright 2010-2013 smartics, Kronseder & Reiner GmbH
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 de.smartics.testdoc.report.junit;
17  
18  import java.io.Serializable;
19  import java.util.LinkedHashMap;
20  import java.util.Map;
21  
22  /**
23   * Provides information about a single test case.
24   *
25   * @author <a href="mailto:robert.reiner@smartics.de">Robert Reiner</a>
26   * @version $Revision:591 $
27   */
28  public class JUnitTestCaseDoc implements Serializable
29  {
30    // ********************************* Fields *********************************
31  
32    // --- constants ------------------------------------------------------------
33  
34    /**
35     * The class version identifier.
36     */
37    private static final long serialVersionUID = 1L;
38  
39    // --- members --------------------------------------------------------------
40  
41    /**
42     * The collection of test methods owned by this test case.
43     * <p>
44     * The key is the name of the test method.
45     */
46    private final Map<String, JUnitTestMethodDoc> testMethods =
47        new LinkedHashMap<String, JUnitTestMethodDoc>();
48  
49    // ****************************** Initializer *******************************
50  
51    // ****************************** Constructors ******************************
52  
53    /**
54     * Default constructor.
55     */
56    public JUnitTestCaseDoc()
57    {
58    }
59  
60    // ****************************** Inner Classes *****************************
61  
62    // ********************************* Methods ********************************
63  
64    // --- init -----------------------------------------------------------------
65  
66    // --- get&set --------------------------------------------------------------
67  
68    // --- business -------------------------------------------------------------
69  
70    public void addTestMethod(final JUnitTestMethodDoc testMethod)
71    {
72      final String methodName = testMethod.getTestMethodName();
73      assert !testMethods.containsKey(methodName) : "Test method information must not be added twice";
74      testMethods.put(methodName, testMethod);
75    }
76  
77    public JUnitTestMethodDoc getTestMethod(final String testMethodName)
78    {
79      return testMethods.get(testMethodName);
80    }
81  
82    // --- object basics --------------------------------------------------------
83  
84  }