I recently tried to run my junit tests to ensure that I didn’t break anything after monkeying around with my code, and I ran into the following error:
1
|
Exception in thread "main" java.lang.RuntimeException: Stub! |
Here’s my code that runs my tests:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
public class RunTestSuite {
public static void main(String[] a) {
TestRunner.run(suite()); } public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(MyClassTests. class );
return suite;
} } |
The stack trace pointed to line 8, so I didn’t know what to make of it since I just had this setup correctly, and TestSuite is a JUnit thing.
Googling mostly resulted in issues with using an Android Test Project (I’m not) and running the tests in your desktop’s JVM instead of the actual device’s (seehere).
Eventually, though, I foundthis postthat informed me that the JUnit library needs to be at the top of the test project’s build order.
Here are the steps to change the build order in Eclipse:
- Right-click your test project
- Click Bulid Path->Configure Build Path…
- Click the Order and Export tab
- Select the JUnit reference
- Click the Top button
通过把android.jar调整到bottom似乎有用
相关推荐
解决 java.lang.RuntimeException: Could not generate DH keypair异常处理。 bcprov-ext-jdk15on-1.60、bcprov-jdk15on-1.60两个包放到jre下的$JAVA_HOME/jre/lib/ext的路径下,然后配置$JAVA_HOME/jre/lib/...
java.lang.RuntimeException: Unsupported algorithm: HmacSHA1 解决方法,阿里云
### Java.lang.OutOfMemoryError: Java Heap Space 解决方法详解 在Java开发与运维中,`java.lang.OutOfMemoryError: Java heap space`是一个常见的错误信息,它表明JVM(Java虚拟机)的堆内存已经耗尽,无法再分配...
在Java编程中,`java.lang.RuntimeException` 是一个非检查异常(unchecked exception),它表示程序运行时出现的不正常情况。通常,这类异常是由于程序员的错误或代码逻辑的疏忽造成的,例如类型转换错误、空指针...
1、修改jdk/jre/lib/security/java.security,加粗部分放到最前面,其它依次修改编号放到后面 security.provider.1=org.bouncycastle.jce.provider.BouncyCastleProvider security.provider.2=sun.security....
Caused by: java.lang.RuntimeException: javax.management.remote.JMXServerErrorException: java.lang.AssertionError: Registered more than one instance with the same objectName : com.bea:Name=wl04,Type=...
Java中的`java.lang.OutOfMemoryError`是一种常见的运行时错误,通常表示应用程序在尝试分配内存时遇到了问题。根据提供的信息,这个错误主要涉及到两个方面:`PermGen space`和`Java heap`,并且与Tomcat服务器相关...
Java中的`java.lang.UnsatisfiedLinkError`是一个常见的运行时异常,通常出现在Java试图加载本地(C或C++)库但找不到相应的库文件时。这个错误可能是由于多种原因引起的,如库路径设置不正确、库文件不存在或者版本...
然而,当你遇到“javax.net.ssl.SSLException: java.lang.RuntimeException: Could not generate DH keypair”的错误时,这意味着在建立SSL/TLS连接时,Diffie-Hellman(DH)密钥交换算法遇到了问题。DH是一种非对称...
`java.lang.UnsupportedOperationException`是Java中的一个运行时异常,它属于`RuntimeException`的子类。这个异常通常在尝试调用一个不支持的操作时抛出。在Java编程中,某些方法可能在特定对象或特定条件下不支持...
05-27 15:35:11.487 E/AndroidRuntime( 2352): java.lang.RuntimeException: Unable to create service com.android.systemui.keyguard.KeyguardService: java.lang.SecurityException: read wallpaper: Neither ...
加密是报:javax.net.ssl.SSLException: java.lang.RuntimeException: Could not generate DH keypair 此处提供 bcprov-ext-jdk15on-154.jar 和 bcprov-jdk15on-154.jar 压缩包中有使用说明
加密是报:javax.net.ssl.SSLException: java.lang.RuntimeException: Could not generate DH keypair 此处提供 bcprov-ext-jdk15on-154.jar 和 bcprov-jdk15on-154.jar 压缩包中有使用说明
在Java编程中,`java.sql.SQLException: 结果集已耗尽` 是一个常见的错误提示,通常出现在处理数据库查询结果集时。这个异常表明程序试图访问已经没有数据的结果集中下一行,即所有行已经被遍历完,尝试访问超出范围...
- **异常路径**:`java.lang.Object -> java.lang.Throwable -> java.lang.Exception -> java.lang.RuntimeException -> java.lang.IndexOutOfBoundsException -> java.lang.ArrayIndexOutOfBoundsException` ...
java.lang.ExceptionInInitializerError Caused by: java.lang.IllegalArgumentException: input == null! at javax.imageio.ImageIO.read(ImageIO.java:1388) at com.pleanwar.fiying.FlyingObject.loadImage...
Load canal adapter: es7 failed java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassCastException: ...canal-adapter1.1.5报错, 将client-adapter.es7x-1.1.5-SNAPSHOT-jar-with-dependencies....
java.lang.OutOfMemoryError是Java开发者在工作中经常会遇到的一个内存错误。该错误通常发生在JVM无法为新对象分配足够的堆内存时。由于内存问题导致的程序崩溃给开发和维护带来了极大的挑战,而解决这类问题需要对...
"Android 兼容性问题:java.lang.UnsupportedOperationException解决办法" Android 兼容性问题:java.lang.UnsupportedOperationException解决办法是 Android 开发中常见的一种问题。该问题会导致应用程序崩溃,...