Project Report: fawkez

Packagesummary org.jcoderz.phoenix.report

org.jcoderz.phoenix.report.FileSummaryTest

LineHitsNoteSource
1  /*
2   * $Id: FileSummaryTest.java 1481 2009-05-23 05:54:44Z amandel $
3   *
4   * Copyright 2006, The jCoderZ.org Project. All rights reserved.
5   *
6   * Redistribution and use in source and binary forms, with or without
7   * modification, are permitted provided that the following conditions are
8   * met:
9   *
10   *    * Redistributions of source code must retain the above copyright
11   *      notice, this list of conditions and the following disclaimer.
12   *    * Redistributions in binary form must reproduce the above
13   *      copyright notice, this list of conditions and the following
14   *      disclaimer in the documentation and/or other materials
15   *      provided with the distribution.
16   *    * Neither the name of the jCoderZ.org Project nor the names of
17   *      its contributors may be used to endorse or promote products
18   *      derived from this software without specific prior written
19   *      permission.
20   *
21   * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND
22   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24   * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS
25   * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28   * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30   * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32   */
33  package org.jcoderz.phoenix.report;
34  
35  import junit.framework.TestCase;
36  
37  /**
38   * Test the FileSummary class.
39   * @author Andreas Mandel
40   */
41100 public class FileSummaryTest
42      extends TestCase
43  {
44      /** Test the {@link FileSummary#getNumberOfFindings()} method. */
45      public void testGetNumberOfFindings ()
46      {
47100         final FileSummary testSummary = new FileSummary();
48  
49100         assertEquals("No violation at all.", 0,
50                  testSummary.getNumberOfFindings());
51100         testSummary.addViolation(Severity.FILTERED);
52100         assertEquals("Filtered should not be count.", 0,
53              testSummary.getNumberOfFindings());
54100         testSummary.addViolation(Severity.OK);
55100         assertEquals("OK should not be count.", 0,
56              testSummary.getNumberOfFindings());
57100         testSummary.addViolation(Severity.COVERAGE);
58100         assertEquals("COVERAGE is not expected to be count.", 0,
59              testSummary.getNumberOfFindings());
60100         testSummary.addViolation(Severity.INFO);
61100         assertEquals("INFO is expected to be count.", 1,
62              testSummary.getNumberOfFindings());
63100         testSummary.addViolation(Severity.CODE_STYLE);
64100(1)        assertEquals("CODE_STYLE is expected to be count.", 2,
65              testSummary.getNumberOfFindings());
66100         testSummary.addViolation(Severity.CPD);
67100(2)        assertEquals("CPD is expected to be count.", 3,
68              testSummary.getNumberOfFindings());
69100         testSummary.addViolation(Severity.DESIGN);
70100(3)        assertEquals("DESIGN is expected to be count.", 4,
71              testSummary.getNumberOfFindings());
72100         testSummary.addViolation(Severity.ERROR);
73100(4)        assertEquals("ERROR is expected to be count.", 5,
74              testSummary.getNumberOfFindings());
75100         testSummary.addViolation(Severity.WARNING);
76100(5)        assertEquals("WARNING is expected to be count.", 6,
77              testSummary.getNumberOfFindings());
78  
79100     }
80  }

Findings in this File

c (1) 64 : 61 '2' is a magic number.
c (2) 67 : 54 '3' is a magic number.
c (3) 70 : 57 '4' is a magic number.
c (4) 73 : 56 '5' is a magic number.
c (5) 76 : 58 '6' is a magic number.