void () { PsiClass aClass = getFile("MyClass").getClasses()[0]; PsiField field1 = aClass.getFields()[0], field2 = aClass.getFields()[1]; assertEquals("field1", field1.getName()); PsiType type1 = field1.getType(); assertEquals(PsiTypes.intType(), type1); assertEquals("int", type1.getPresentableText()); assertTrue(type1 instanceof PsiPrimitiveType); PsiType type2 = field2.getType(); assertTrue(type2.equalsToText("java.lang.Object[]")); assertEquals("Object[]", type2.getPresentableText()); assertFalse(type2 instanceof PsiPrimitiveType); assertTrue(type2 instanceof PsiArrayType); PsiType componentType = ((PsiArrayType)type2).getComponentType(); assertTrue(componentType.equalsToText(CommonClassNames.JAVA_LANG_OBJECT)); assertEquals(CommonClassNames.JAVA_LANG_OBJECT_SHORT, componentType.getPresentableText()); assertFalse(componentType instanceof PsiPrimitiveType); assertFalse(componentType instanceof PsiArrayType); PsiLiteralExpression initializer = (PsiLiteralExpression)field1.getInitializer(); assertNotNull(initializer); assertEquals("123", initializer.getText()); assertEquals(123, initializer.getValue()); assertEquals(PsiTypes.intType(), initializer.getType()); assertFalse(field2.hasInitializer()); assertNull(field2.getInitializer()); }