ReflectionUtil { public static Field[] getDeclaredFields(Class<?> clazz) throws Exception { Field[] fields = clazz.getDeclaredFields(); for (Field field : fields) { field.setAccessible(true); unfinalField(field); } return fields; }  static Object arrayClone(Object array); static Field getDeclaredField(Class<?> clazz, String name); static Field[] getDeclaredFields(Class<?> clazz); static Method getDeclaredMethod(
			Class<?> clazz, String name, Class<?>... parameterTypes); static Class<?>[] getInterfaces(Object object); static Class<?>[] getInterfaces(
		Object object, ClassLoader classLoader); static Class<?>[] getInterfaces(
		Object object, ClassLoader classLoader,
		Consumer<ClassNotFoundException> classNotFoundHandler); static T throwException(Throwable throwable); static Field unfinalField(Field field);  }
@Test public void testGetDeclaredFields() throws Exception { Field[] fields = ReflectionUtil.getDeclaredFields(TestClass.class); for (Field field : fields) { Assert.assertTrue(field.isAccessible()); int modifier = field.getModifiers(); if (Modifier.isStatic(modifier)) { Assert.assertFalse(Modifier.isFinal(modifier)); } String name = field.getName(); if (name.equals("_privateStaticFinalObject")) { Assert.assertSame( TestClass._privateStaticFinalObject, field.get(null)); } else if (name.equals("_privateStaticObject")) { Assert.assertSame( TestClass._privateStaticObject, field.get(null)); } } }