### Question:
MirrorClassFactory implements XTypeFactory { @Override public XClass fromClass(Class<?> c) { if (c == null) { return null; } if (c == byte[].class) { XClass componentType = byteType; String fqn = "[" + componentType.getName(); XClass xclass = classCache.get(fqn); if (xclass == null) { xclass = new MirrorArray(componentType); classCache.put(fqn, xclass); } return xclass; } if (c == void.class) { return voidType; } if (c == boolean.class) { return booleanType; } if (c == byte.class) { return byteType; } if (c == short.class) { return shortType; } if (c == int.class) { return intType; } if (c == long.class) { return longType; } if (c == char.class) { return charType; } if (c == float.class) { return floatType; } if (c == double.class) { return doubleType; } String typeName = c.getCanonicalName(); if (typeName == null) { typeName = c.getName(); } TypeElement typeElement = elements.getTypeElement(typeName); if (typeElement == null) { throw new RuntimeException("Type not found : " + typeName); } return fromTypeMirror(typeElement.asType()); } MirrorClassFactory(ProcessingEnvironment processingEnv); @Override XClass fromClass(Class<?> c); @Override XClass fromTypeMirror(TypeMirror typeMirror);  }### Answer:
@Test public void testFromClass() { ProcessingEnvironment processingEnvironmentMock = mock(ProcessingEnvironment.class); Elements elementsMock = mock(Elements.class); Types typesMock = mock(Types.class); when(processingEnvironmentMock.getElementUtils()).thenReturn(elementsMock); when(processingEnvironmentMock.getTypeUtils()).thenReturn(typesMock); TypeElement typeElementMock = mock(TypeElement.class); DeclaredType typeMirrorMock = mock(DeclaredType.class); when(typeMirrorMock.asElement()).thenReturn(typeElementMock); when(typeElementMock.asType()).thenReturn(typeMirrorMock); when(typeMirrorMock.getKind()).thenReturn(TypeKind.DECLARED); when(typeElementMock.getKind()).thenReturn(ElementKind.CLASS); Name nameMock = mock(Name.class); when(nameMock.toString()).thenReturn("java.lang.Integer"); when(typeElementMock.getQualifiedName()).thenReturn(nameMock); when(elementsMock.getTypeElement("java.lang.Integer")).thenReturn(typeElementMock); when(elementsMock.getBinaryName(typeElementMock)).thenReturn(nameMock); MirrorClassFactory typeFactory = new MirrorClassFactory(processingEnvironmentMock); XClass integerClass = typeFactory.fromClass(Integer.class); assertFalse(integerClass.isArray()); }