01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package org.apache.harmony.sql.tests.java.sql;
19:
20: import java.sql.SQLPermission;
21:
22: import junit.framework.TestCase;
23:
24: /**
25: * JUnit Testcase for the java.sql.SQLPermission class
26: *
27: * Note that the SQLPermission class only defines 2 constructors and all other
28: * methods are inherited. This testcase explicitly tets the constructors but
29: * also implicitly tests some of the inherited query methods.
30: *
31: */
32:
33: public class SQLPermissionTest extends TestCase {
34:
35: /*
36: * Constructor test
37: */
38: public void testSQLPermissionStringString() {
39: String validName = "setLog";
40: String validActions = "theActions";
41:
42: SQLPermission thePermission = new SQLPermission(validName,
43: validActions);
44:
45: assertNotNull(thePermission);
46: assertEquals(validName, thePermission.getName());
47: // System.out.println("The actions: " + thePermission.getActions() + "."
48: // );
49: assertEquals("", thePermission.getActions());
50: } // end method testSQLPermissionStringString
51:
52: /*
53: * Constructor test
54: */
55: public void testSQLPermissionString() {
56: String validName = "setLog";
57:
58: SQLPermission thePermission = new SQLPermission(validName);
59:
60: assertNotNull(thePermission);
61: assertEquals(validName, thePermission.getName());
62:
63: // Set an invalid name ...
64: String invalidName = "foo";
65:
66: thePermission = new SQLPermission(invalidName);
67:
68: assertNotNull(thePermission);
69: assertEquals(invalidName, thePermission.getName());
70: assertEquals("", thePermission.getActions());
71: } // end method testSQLPermissionString
72:
73: } // end class SQLPermissionTest
|