summaryrefslogtreecommitdiffstats
path: root/test-runner/src
diff options
context:
space:
mode:
authorRaluca Sauciuc <ralucas@google.com>2014-10-03 10:58:29 -0700
committerRaluca Sauciuc <ralucas@google.com>2014-10-03 10:58:29 -0700
commit0180dfeff341639011ce005a6707c9dc3b55f5df (patch)
tree52af2d8a04cd4d261ffeb67513377ac9ddafd625 /test-runner/src
parentb27d43a8805769f9a9dfdc024b5cd19b71cfd8d7 (diff)
downloadframeworks_base-0180dfeff341639011ce005a6707c9dc3b55f5df.zip
frameworks_base-0180dfeff341639011ce005a6707c9dc3b55f5df.tar.gz
frameworks_base-0180dfeff341639011ce005a6707c9dc3b55f5df.tar.bz2
Fix test framework to allow Mockito tests to run successfully on ART.
Currently, Mockito tests don't run on ART (KitKat & L) due to an extra NoClassDefFoundError exception being thrown while trying to resolve internal test runner classes. These exceptions are benign, Mockito's internal test runners all inherit from org.junit.runner.Runner, which is not included in the setup, but none of them are actually used in tests. The same apks succeed on Dalvik, and logcat shows the same exceptions going by, minus the NCDFE's. Section 5.3 of the VM spec says the virtual machine has to wrap a ClassNotFoundException in NoClassDefFoundError if the first exception arises from verification or resolution but not initialization of that particular class. Bug: 17042833 Change-Id: I3af20f6884d9fa3afc3fbf9fcb238be10267827a
Diffstat (limited to 'test-runner/src')
-rw-r--r--test-runner/src/android/test/ClassPathPackageInfoSource.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/test-runner/src/android/test/ClassPathPackageInfoSource.java b/test-runner/src/android/test/ClassPathPackageInfoSource.java
index 7b10e38..0ffecdb 100644
--- a/test-runner/src/android/test/ClassPathPackageInfoSource.java
+++ b/test-runner/src/android/test/ClassPathPackageInfoSource.java
@@ -87,7 +87,7 @@ public class ClassPathPackageInfoSource {
// We get errors in the emulator if we don't use the caller's class loader.
topLevelClasses.add(Class.forName(className, false,
(classLoader != null) ? classLoader : CLASS_LOADER));
- } catch (ClassNotFoundException e) {
+ } catch (ClassNotFoundException | NoClassDefFoundError e) {
// Should not happen unless there is a generated class that is not included in
// the .apk.
Log.w("ClassPathPackageInfoSource", "Cannot load class. "