1/*
2 *  Licensed to the Apache Software Foundation (ASF) under one or more
3 *  contributor license agreements.  See the NOTICE file distributed with
4 *  this work for additional information regarding copyright ownership.
5 *  The ASF licenses this file to You under the Apache License, Version 2.0
6 *  (the "License"); you may not use this file except in compliance with
7 *  the License.  You may obtain a copy of the License at
8 *
9 *     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
18package org.apache.harmony.luni.tests.java.lang.reflect;
19
20import java.lang.reflect.AccessibleObject;
21
22public class AccessibleObjectTest extends junit.framework.TestCase {
23
24	public class TestClass {
25		public Object aField;
26	}
27
28	/**
29	 * @tests java.lang.reflect.AccessibleObject#isAccessible()
30	 */
31	public void test_isAccessible() throws Exception {
32		// Test for method boolean
33		// java.lang.reflect.AccessibleObject.isAccessible()
34                AccessibleObject ao = TestClass.class.getField("aField");
35                ao.setAccessible(true);
36                assertTrue("Returned false to isAccessible", ao.isAccessible());
37                ao.setAccessible(false);
38                assertTrue("Returned true to isAccessible", !ao.isAccessible());
39	}
40
41	/**
42	 * @tests java.lang.reflect.AccessibleObject#setAccessible(java.lang.reflect.AccessibleObject[],
43	 *        boolean)
44	 */
45	public void test_setAccessible$Ljava_lang_reflect_AccessibleObjectZ() throws Exception {
46		// Test for method void
47		// java.lang.reflect.AccessibleObject.setAccessible(java.lang.reflect.AccessibleObject
48		// [], boolean)
49                AccessibleObject ao = TestClass.class.getField("aField");
50                AccessibleObject[] aoa = new AccessibleObject[] { ao };
51                AccessibleObject.setAccessible(aoa, true);
52                assertTrue("Returned false to isAccessible", ao.isAccessible());
53                AccessibleObject.setAccessible(aoa, false);
54                assertTrue("Returned true to isAccessible", !ao.isAccessible());
55	}
56
57	/**
58	 * @tests java.lang.reflect.AccessibleObject#setAccessible(boolean)
59	 */
60	public void test_setAccessibleZ() {
61		// Test for method void
62		// java.lang.reflect.AccessibleObject.setAccessible(boolean)
63		assertTrue("Used to test", true);
64	}
65
66	/**
67	 * Sets up the fixture, for example, open a network connection. This method
68	 * is called before a test is executed.
69	 */
70	protected void setUp() {
71	}
72
73	/**
74	 * Tears down the fixture, for example, close a network connection. This
75	 * method is called after a test is executed.
76	 */
77	protected void tearDown() {
78	}
79}
80