Home | History | Annotate | Download | only in mocking

Lines Matching defs:Class

37  * This class will pull pre-defined mocks for Android framework classes. This is
39 * version Y, where the specification of the class being mocked will have
44 public class AndroidFrameworkMockGenerator {
49 * Returns a set of mock support classes for the specified Class for all versions of
50 * the Android SDK. If the requested class is not part of the Android framework, then the class
53 * @param clazz the class to mock.
55 * the requested Class.
57 public List<GeneratedClassFile> getMocksForClass(Class<?> clazz) throws ClassNotFoundException,
59 List<Class<?>> prebuiltClasses = getPrebuiltClassesFor(clazz);
61 for (Class<?> prebuiltClass : prebuiltClasses) {
66 throw new ClassNotFoundException("Missing class while fetching prebuilt mocks: "
76 private List<Class<?>> getPrebuiltClassesFor(Class<?> clazz) throws ClassNotFoundException {
77 List<Class<?>> classes = new ArrayList<Class<?>>();
80 classes.add(Class.forName(FileUtils.getSubclassNameFor(clazz, sdkVersion)));
81 classes.add(Class.forName(FileUtils.getInterfaceNameFor(clazz, sdkVersion)));
88 * class for a single version of the Android SDK.
90 public List<GeneratedClassFile> createMocksForClass(Class<?> clazz, SdkVersion version)
99 * @return A list of all class files inside the provided jar file.
101 List<Class<?>> getClassList(JarFile jar) throws ClassNotFoundException {
105 List<Class<?>> getClassList(Collection<JarEntry> jarEntries) throws ClassNotFoundException {
106 List<Class<?>> classList = new ArrayList<Class<?>>();
109 classList.add(Class.forName(FileUtils.getClassNameFor(jarEntry.getName())));
116 * @return true if the provided JarEntry represents a class file.
119 return jarEntry.getName().endsWith(".class");
140 List<Class<?>> classList = mockGenerator.getClassList(jar);
142 for (Class<?> clazz : classList) {