### Question:
JavassistUtils { public static boolean isArrayOf(CtField field, CtClass typeOfArrayElements) throws NotFoundException { return field.getType().isArray() && field.getType() .getComponentType() .subtypeOf(typeOfArrayElements); } private  JavassistUtils(); static boolean isArrayOf(CtField field, CtClass typeOfArrayElements); static boolean isArrayOf(CtField field, ClassPool classPool, Class<?> superClass); static boolean isBooleanArray(CtField field); static boolean isByteArray(CtField field); static boolean isCharArray(CtField field); static boolean isDoubleArray(CtField field); static boolean isFloatArray(CtField field); static boolean isIntArray(CtField field); static boolean isLongArray(CtField field); static boolean isShortArray(CtField field); static boolean isCharSequenceArray(CtField field, ClassPool classPool); static boolean isStringArray(CtField field, ClassPool classPool); static boolean isArrayList(CtField field, ClassPool classPool); static boolean isParcelableArray(CtField field, ClassPool classPool); static boolean isSerializableArray(CtField field, ClassPool classPool); static boolean isActivity(CtClass clazz); static boolean isService(CtClass clazz); static boolean isContext(CtClass clazz); static boolean isBroadCastReceiver(CtClass clazz); static boolean isContentProvider(CtClass clazz); static boolean isApplication(CtClass clazz); static boolean isFragment(CtClass clazz); static boolean isSupportFragment(CtClass clazz); static boolean isView(CtClass clazz); static boolean isSubType(ClassPool classPool, CtClass clazz, Class<?> superClass); static boolean isSubClass(ClassPool classPool, CtClass clazz, Class<?> superClass); static boolean isSubClass(ClassPool classPool, CtClass clazz, String superClassName); static List<CtField> getAllInjectedFieldsForAnnotation(CtClass clazz,
      Class<? extends Annotation> annotationClazz); static List<CtConstructor> extractValidConstructors(final CtClass classToTransform,
      CtClassFilter filter); static int findValidParamIndex(CtClass[] parameterTypes, CtClassFilter filter);  }### Answer:
@Test public void testIsArrayOf_returnTrue() throws Exception { ClassPool classPool = ClassPool.getDefault(); CtField field = CtField.make("Integer[] f;", testClass); assertThat(JavassistUtils.isArrayOf(field, classPool, Number.class), is(true)); }
@Test public void testIsArrayOf_returnFalseWithBadArrayType() throws Exception { CtField field = CtField.make("String[] f;", testClass); assertThat(JavassistUtils.isArrayOf(field, ClassPool.getDefault(), Foo.class), is(false)); }
@Test public void testIsArrayOf_returnFalseWithBadType() throws Exception { CtField field = CtField.make("String f;", testClass); assertThat(JavassistUtils.isArrayOf(field, ClassPool.getDefault(), Foo.class), is(false)); }
@Test public void testIsArrayOf_returnFalseWithBadArrayType2() throws Exception { CtField field = CtField.make("String[] f;", testClass); assertThat(JavassistUtils.isArrayOf(field, CtClass.intType), is(false)); }
@Test public void testIsArrayOf_returnFalseWithBadType2() throws Exception { CtField field = CtField.make("int f;", testClass); assertThat(JavassistUtils.isArrayOf(field, CtClass.intType), is(false)); }
@Test(expected = NotFoundException.class) public void testIsArrayOf_shouldThrowExceptionWhenClassNotFound() throws Exception { CtField field = CtField.make("String[] f;", testClass); JavassistUtils.isArrayOf(field, new ClassPool(), Foo.class); }