1   /**
2    * This program is free software: you can redistribute it and/or modify
3    * it under the terms of the GNU General Public License as published by
4    * the Free Software Foundation, version 3.
5    *
6    * This program is distributed in the hope that it will be useful,
7    * but WITHOUT ANY WARRANTY; without even the implied warranty of
8    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9    * GNU General Public License for more details.
10   *
11   * You should have received a copy of the GNU General Public License
12   * along with this program. If not, see <http://www.gnu.org/licenses/>.
13   */
14  
15  package net.curre.prefcount;
16  
17  import java.io.IOException;
18  import java.util.logging.FileHandler;
19  import java.util.logging.Handler;
20  import java.util.logging.Level;
21  import java.util.logging.Logger;
22  import java.util.logging.SimpleFormatter;
23  
24  import net.curre.prefcount.event.AllEventsTest;
25  import net.curre.prefcount.gui.DialogInnerPanelTest;
26  import net.curre.prefcount.gui.GeneralTest;
27  import net.curre.prefcount.gui.PrefSkinsTest;
28  import net.curre.prefcount.service.LafThemeServiceTest;
29  import net.curre.prefcount.service.ResultServiceTest;
30  import net.curre.prefcount.service.SettingsServiceTest;
31  import net.curre.prefcount.util.LocaleExtTest;
32  import net.curre.prefcount.util.UtilitiesTest;
33  
34  import junit.framework.Test;
35  import junit.framework.TestCase;
36  import junit.framework.TestSuite;
37  
38  /**
39   * Unit test suite for prefCount application.
40   * <p/>
41   * Created date: May 4, 2007
42   *
43   * @author Yevgeny Nyden
44   */
45  public class AppTest extends TestCase {
46  
47    /** Application test log file path. */
48    private static final String TEST_LOG_PATH = "target/prefcount-test.log";
49  
50    /** Application test log level. */
51    private static final Level TEST_LOG_LEVEL = Level.FINE;
52  
53    /**
54     * Returns the suite of all unit tests.
55     *
56     * @return The suite of all tests being tested.
57     */
58    public static Test suite() {
59      // setting test logger
60      try {
61        Handler fh = new FileHandler(TEST_LOG_PATH);
62        fh.setFormatter(new SimpleFormatter());
63        Logger.getLogger("").addHandler(fh);
64        Logger.getLogger("").setLevel(TEST_LOG_LEVEL);
65      } catch (IOException e) {
66        System.out.println("ERROR setting test logger!");
67        e.printStackTrace();
68      }
69  
70      // creating test suite
71      TestSuite suite = new TestSuite();
72      suite.addTestSuite(PrefCountRegistryTest.class);
73      suite.addTestSuite(SettingsServiceTest.class);
74      suite.addTestSuite(ResultServiceTest.class);
75      suite.addTestSuite(LafThemeServiceTest.class);
76      suite.addTestSuite(LocaleExtTest.class);
77      suite.addTestSuite(UtilitiesTest.class);
78      suite.addTestSuite(GeneralTest.class);
79      suite.addTestSuite(DialogInnerPanelTest.class);
80      suite.addTestSuite(PrefSkinsTest.class);
81      suite.addTestSuite(AllEventsTest.class);
82      return suite;
83    }
84  
85  }