Project Report: fawkez

Packagesummary org.jcoderz.phoenix.report

org.jcoderz.phoenix.report.Java2HtmlTest

LineHitsNoteSource
1  /*
2   * $Id: ReportReaderFactoryTest.java 1450 2009-05-09 22:54:06Z 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 java.text.ParseException;
36  
37  import org.jcoderz.commons.types.Date;
38  
39  import junit.framework.TestCase;
40  
41  /**
42   * Test part of the {@link Java2Html} class.
43   * @author amandel
44   */
45100 public class Java2HtmlTest
46      extends TestCase
47  {
48      private static final Date END_TEST_WEEK;
49      private static final Date START_TEST_WEEK;
50  
51      static
52      {
53          try
54          {
55100             START_TEST_WEEK = Date.fromString("2009-05-18T00:00:00.000Z");
56100             END_TEST_WEEK = Date.fromString("2009-05-25T00:00:00.000Z");
57          }
580         catch (ParseException e)
59          {
600             throw new ExceptionInInitializerError(e);
61100         }
62100     }
63  
64      /**
65       * Test method for {@link Java2Html#getPeriodStart(ReportInterval, Date)}.
66       * @throws ParseException in case of an internal error.
67       */
68      public void testGetPeriodStart ()
69          throws ParseException
70      {
71100(1)        assertEquals("Unexpected start for week.",
72              START_TEST_WEEK,
73              Java2Html.getPeriodStart(ReportInterval.WEEK,
74                  Date.fromString("2009-05-22T20:20:20.200Z")));
75100         assertEquals("Unexpected start for week.",
76              START_TEST_WEEK,
77              Java2Html.getPeriodStart(ReportInterval.WEEK,
78                  Date.fromString("2009-05-21T20:20:20.200Z")));
79100         assertEquals("Unexpected start for week.",
80              START_TEST_WEEK,
81              Java2Html.getPeriodStart(ReportInterval.WEEK,
82                  Date.fromString("2009-05-20T20:20:20.200Z")));
83100         assertEquals("Unexpected start for week.",
84              START_TEST_WEEK,
85              Java2Html.getPeriodStart(ReportInterval.WEEK,
86                  Date.fromString("2009-05-19T20:20:20.200Z")));
87100         assertEquals("Unexpected start for week.",
88              START_TEST_WEEK,
89              Java2Html.getPeriodStart(ReportInterval.WEEK,
90                  Date.fromString("2009-05-18T20:20:20.200Z")));
91100     }
92  
93      /**
94       * Test method for {@link Java2Html#getPeriodEnd(ReportInterval, Date)}.
95       * @throws ParseException in case of an internal error.
96       */
97      public void testGetPeriodEnd ()
98          throws ParseException
99      {
100100(2)        assertEquals("Unexpected end for week.",
101              END_TEST_WEEK,
102              Java2Html.getPeriodEnd(ReportInterval.WEEK,
103                  Date.fromString("2009-05-22T20:20:20.200Z")));
104100         assertEquals("Unexpected end for week.",
105              END_TEST_WEEK,
106              Java2Html.getPeriodEnd(ReportInterval.WEEK,
107                  Date.fromString("2009-05-23T20:20:20.200Z")));
108100         assertEquals("Unexpected end for week.",
109              END_TEST_WEEK,
110              Java2Html.getPeriodEnd(ReportInterval.WEEK,
111                  Date.fromString("2009-05-24T20:20:20.200Z")));
112100         assertEquals("Unexpected end for week.",
113              Date.fromString("2009-06-01T00:00:00.000Z"),
114              Java2Html.getPeriodEnd(ReportInterval.WEEK,
115                  Date.fromString("2009-05-25T20:20:20.200Z")));
116100         assertEquals("Unexpected end for week.",
117              Date.fromString("2009-06-01T00:00:00.000Z"),
118              Java2Html.getPeriodEnd(ReportInterval.WEEK,
119                  Date.fromString("2009-05-31T23:20:20.200Z")));
120100     }
121  }

Findings in this File

i (1) 71 : 22 The String literal "Unexpected start for week." appears 5 times in this file; the first occurrence is on line 71 (test code)
i (2) 100 : 22 The String literal "Unexpected end for week." appears 5 times in this file; the first occurrence is on line 100 (test code)