01: // jTDS JDBC Driver for Microsoft SQL Server and Sybase
02: // Copyright (C) 2005 The jTDS Project
03: //
04: // This library is free software; you can redistribute it and/or
05: // modify it under the terms of the GNU Lesser General Public
06: // License as published by the Free Software Foundation; either
07: // version 2.1 of the License, or (at your option) any later version.
08: //
09: // This library is distributed in the hope that it will be useful,
10: // but WITHOUT ANY WARRANTY; without even the implied warranty of
11: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: // Lesser General Public License for more details.
13: //
14: // You should have received a copy of the GNU Lesser General Public
15: // License along with this library; if not, write to the Free Software
16: // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: //
18: package net.sourceforge.jtds.test;
19:
20: import net.sourceforge.jtds.jdbc.Support;
21:
22: /**
23: * Unit tests for the {@link net.sourceforge.jtds.jdbc.Support} class.
24: *
25: * @author David D. Kilzer
26: * @version $Id: SupportUnitTest.java,v 1.1 2005/09/06 23:03:21 ddkilzer Exp $
27: */
28: public class SupportUnitTest extends UnitTestBase {
29:
30: private static final String SYSTEM_PROPRETY_OS_NAME = "os.name";
31: private String osName;
32:
33: /**
34: * Constructor.
35: *
36: * @param name The name of the test.
37: */
38: public SupportUnitTest(String name) {
39: super (name);
40: }
41:
42: protected void setUp() throws Exception {
43: super .setUp();
44: this .osName = System.getProperty(SYSTEM_PROPRETY_OS_NAME);
45: }
46:
47: protected void tearDown() throws Exception {
48: System.setProperty(SYSTEM_PROPRETY_OS_NAME, this .osName);
49: super .tearDown();
50: }
51:
52: public void testIsWindowsOS_Linux() {
53: System.setProperty(SYSTEM_PROPRETY_OS_NAME, "Linux");
54: assertFalse(Support.isWindowsOS());
55: }
56:
57: public void testIsWindowsOS_MacOSX() {
58: System.setProperty(SYSTEM_PROPRETY_OS_NAME, "MacOSX");
59: assertFalse(Support.isWindowsOS());
60: }
61:
62: public void testIsWindowsOS_windows() {
63: System.setProperty(SYSTEM_PROPRETY_OS_NAME, "windows");
64: assertTrue(Support.isWindowsOS());
65: }
66:
67: public void testIsWindowsOS_Windows() {
68: System.setProperty(SYSTEM_PROPRETY_OS_NAME, "Windows");
69: assertTrue(Support.isWindowsOS());
70: }
71:
72: public void testIsWindowsOS_Windows_XP() {
73: System.setProperty(SYSTEM_PROPRETY_OS_NAME, "Windows XP");
74: assertTrue(Support.isWindowsOS());
75: }
76:
77: }
|