EMMA Coverage Report (generated Fri Jul 28 01:51:09 CEST 2006)
[all classes][org.jtiger.report.html]

COVERAGE SUMMARY FOR SOURCE FILE [ResultMappingFactory.java]

nameclass, %method, %block, %line, %
ResultMappingFactory.java100% (2/2)100% (5/5)100% (142/142)100% (31/31)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ResultMappingFactory100% (1/1)100% (2/2)100% (7/7)100% (3/3)
ResultMappingFactory (): void 100% (1/1)100% (3/3)100% (2/2)
newResultMapping (): ResultMapping 100% (1/1)100% (4/4)100% (1/1)
     
class ResultMappingFactory$ResultMappingImpl100% (1/1)100% (3/3)100% (135/135)100% (28/28)
ResultMappingFactory$ResultMappingImpl (): void 100% (1/1)100% (115/115)100% (22/22)
getResultMapping (String): TestResultType 100% (1/1)100% (10/10)100% (3/3)
getResultMapping (TestResultType): String 100% (1/1)100% (10/10)100% (3/3)

1/*
2 * JTiger Unit Testing Framework for J2SE 1.5
3 * Copyright (C) 2005 Tony Morris
4 *
5 * This software is licenced under the
6 * Common Public Licence version 1.0
7 * http://www.opensource.org/licenses/cpl1.0.php
8 *
9 * You received a copy of this licence with this software.
10 */
11package org.jtiger.report.html;
12 
13import java.util.Map;
14import java.util.ResourceBundle;
15import java.util.TreeMap;
16import org.jtiger.framework.TestResultType;
17import static org.jtiger.framework.TestResultType.SUCCESS;
18import static org.jtiger.framework.TestResultType.FAILURE;
19import static org.jtiger.framework.TestResultType.FAILURE_SETUP;
20import static org.jtiger.framework.TestResultType.FAILURE_TEARDOWN;
21import static org.jtiger.framework.TestResultType.IGNORED_ANNOTATED;
22import static org.jtiger.framework.TestResultType.IGNORED_CANNOT_INVOKE;
23 
24final class ResultMappingFactory
25{
26    public static final String BUNDLE = "org/jtiger/report/html/ResultMapping";
27 
28    private ResultMappingFactory()
29    {
30 
31    }
32 
33    static ResultMapping newResultMapping()
34    {
35        return new ResultMappingImpl();
36    }
37 
38    private static final class ResultMappingImpl implements ResultMapping
39    {
40        private final Map<TestResultType, String> mapping;
41        private final Map<String, TestResultType> reverseMapping;
42 
43        ResultMappingImpl()
44        {
45            mapping = new TreeMap<TestResultType, String>();
46            reverseMapping = new TreeMap<String, TestResultType>();
47 
48            final String failure = ResourceBundle.getBundle(BUNDLE).getString("failure");
49            final String failureSetup = ResourceBundle.getBundle(BUNDLE).getString("failure.setup");
50            final String failureTeardown = ResourceBundle.getBundle(BUNDLE).getString("failure.teardown");
51            final String ignoredAnnotated = ResourceBundle.getBundle(BUNDLE).getString("ignored.annotated");
52            final String ignoredCannotInvoke = ResourceBundle.getBundle(BUNDLE).getString("ignored.cannot.invoke");
53            final String success = ResourceBundle.getBundle(BUNDLE).getString("success");
54 
55            mapping.put(FAILURE, failure);
56            mapping.put(FAILURE_SETUP, failureSetup);
57            mapping.put(FAILURE_TEARDOWN, failureTeardown);
58            mapping.put(IGNORED_ANNOTATED, ignoredAnnotated);
59            mapping.put(IGNORED_CANNOT_INVOKE, ignoredCannotInvoke);
60            mapping.put(SUCCESS, success);
61 
62            reverseMapping.put(failure, FAILURE);
63            reverseMapping.put(failureSetup, FAILURE_SETUP);
64            reverseMapping.put(failureTeardown, FAILURE_TEARDOWN);
65            reverseMapping.put(ignoredAnnotated, IGNORED_ANNOTATED);
66            reverseMapping.put(ignoredCannotInvoke, IGNORED_CANNOT_INVOKE);
67            reverseMapping.put(success, SUCCESS);
68        }
69 
70        public String getResultMapping(final TestResultType result)
71        {
72            if(result == null)
73            {
74                return null;
75            }
76 
77            return mapping.get(result);
78        }
79 
80        public TestResultType getResultMapping(final String s)
81        {
82            if(s == null)
83            {
84                return null;
85            }
86 
87            return reverseMapping.get(s);
88        }
89    }
90}

[all classes][org.jtiger.report.html]
EMMA 2.0.5312 (C) Vladimir Roubtsov