Android中使用JUnit4测试发生fatal error

在一个Android的项目中写了一个类,如下:
 
然后新建一个test文件夹,里面放入要测试的类方法,如下:
 
 
运行testConvertToGroup方法后发生错误为:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (classFileParser.cpp:3494), pid=10872, tid=11016
# Error: ShouldNotReachHere()
#
# JRE version: 6.0_31-b05
# Java VM: Java HotSpot(TM) 64-Bit Server VM (20.6-b01 mixed mode windows-amd64 compressed oops)
# An error report file with more information is saved as:
# D:\workspace\Android\Calculator\hs_err_pid10872.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#
 
截图如下:
 
 
log文件的内容为:
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (classFileParser.cpp:3494), pid=9956, tid=9252
#  Error: ShouldNotReachHere()
#
# JRE version: 6.0_31-b05
# Java VM: Java HotSpot(TM) 64-Bit Server VM (20.6-b01 mixed mode windows-amd64 compressed oops)
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#
 
---------------  T H R E A D  ---------------
 
Current thread (0x000000000051c000):  JavaThread "Unknown thread" [_thread_in_vm, id=9252, stack(0x0000000002900000,0x0000000002a00000)]
 
Stack: [0x0000000002900000,0x0000000002a00000]
[error occurred during error reporting (printing stack bounds), id 0xc0000005]
 
 
---------------  P R O C E S S  ---------------
 
Java Threads: ( => current thread )
 
Other Threads:
 
=>0x000000000051c000 (exited) JavaThread "Unknown thread" [_thread_in_vm, id=9252, stack(0x0000000002900000,0x0000000002a00000)]
 
VM state:not at safepoint (not fully initialized)
 
VM Mutex/Monitor currently owned by a thread: None
 
Dynamic libraries:
0x0000000000400000 - 0x000000000042f000     C:\Program Files\Java\jdk1.6.0_31\bin\javaw.exe
0x0000000077530000 - 0x00000000776dc000     C:\Windows\SYSTEM32\ntdll.dll
0x0000000077310000 - 0x000000007742f000     C:\Windows\system32\kernel32.dll
0x000007fefd380000 - 0x000007fefd3ec000     C:\Windows\system32\KERNELBASE.dll
0x000007fefe6b0000 - 0x000007fefe78b000     C:\Windows\system32\ADVAPI32.dll
0x000007feff410000 - 0x000007feff4af000     C:\Windows\system32\msvcrt.dll
0x000007fefed30000 - 0x000007fefed4f000     C:\Windows\SYSTEM32\sechost.dll
0x000007feff710000 - 0x000007feff83e000     C:\Windows\system32\RPCRT4.dll
0x0000000077430000 - 0x000000007752a000     C:\Windows\system32\USER32.dll
0x000007feff3a0000 - 0x000007feff407000     C:\Windows\system32\GDI32.dll
0x000007feff390000 - 0x000007feff39e000     C:\Windows\system32\LPK.dll
0x000007fefe7c0000 - 0x000007fefe88a000     C:\Windows\system32\USP10.dll
0x000007fefe790000 - 0x000007fefe7be000     C:\Windows\system32\IMM32.DLL
0x000007fefe580000 - 0x000007fefe689000     C:\Windows\system32\MSCTF.dll
0x000007fefd210000 - 0x000007fefd254000     C:\Windows\system32\nvinitx.dll
0x000000000f000000 - 0x000000000f006000     C:\Program Files\NVIDIA Corporation\CoProcManager\_etoured.dll
0x000007fefa900000 - 0x000007fefa945000     C:\Program Files\NVIDIA Corporation\CoProcManager\nvd3d9wrapx.dll
0x000007feff080000 - 0x000007feff257000     C:\Windows\system32\SETUPAPI.dll
0x000007fefd560000 - 0x000007fefd596000     C:\Windows\system32\CFGMGR32.dll
0x000007fefed50000 - 0x000007fefee27000     C:\Windows\system32\OLEAUT32.dll
0x000007fefeaa0000 - 0x000007fefeca2000     C:\Windows\system32\ole32.dll
0x000007fefd680000 - 0x000007fefd69a000     C:\Windows\system32\DEVOBJ.dll
0x000007fefa510000 - 0x000007fefa547000     C:\Program Files\NVIDIA Corporation\CoProcManager\nvdxgiwrapx.dll
0x000000006d8b0000 - 0x000000006e068000     C:\Program Files\Java\jdk1.6.0_31\jre\bin\server\jvm.dll
0x000007fefd5a0000 - 0x000007fefd5db000     C:\Windows\system32\WINMM.dll
0x000000006d820000 - 0x000000006d82e000     C:\Program Files\Java\jdk1.6.0_31\jre\bin\verify.dll
0x000000006d450000 - 0x000000006d477000     C:\Program Files\Java\jdk1.6.0_31\jre\bin\java.dll
0x000000006d870000 - 0x000000006d882000     C:\Program Files\Java\jdk1.6.0_31\jre\bin\zip.dll
0x0000000077700000 - 0x0000000077707000     C:\Windows\system32\PSAPI.DLL
 
VM Arguments:
jvm_args: -Dfile.encoding=UTF-8 -Xbootclasspath:D:\DevelopTools\SDK\android-sdk-windows\platforms\android-10\android.jar
java_command: org.eclipse.jdt.internal.junit.runner.RemoteTestRunner -version 3 -port 52766 -testLoaderClass org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader -loaderpluginname org.eclipse.jdt.junit.runtime -test org.fra.utils.NumberUtilsTest:convertToGroupTest
Launcher Type: SUN_STANDARD
 
Environment Variables:
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_31
CLASSPATH=.;C:\Program Files\Java\jdk1.6.0_31\lib
PATH=C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Java\jdk1.6.0_31\bin;D:\Program Files (x86)\Kingsoft\WPS Office Personal\office6;C:\Program Files\TortoiseSVN\bin;D:\DevelopTools\SDK\Android_SDK\plantform-tools;D:\Program Files\MySQL\MySQL Server 5.1\bin;D:\Program Files (x86)\EditPlus\;D:\Program Files (x86)\SSH Communications Security\SSH Secure Shell
USERNAME=Francis
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
 
 
 
---------------  S Y S T E M  ---------------
 
OS: Windows 7 , 64 bit Build 7600
 
CPU:total 8 (4 cores per cpu, 2 threads per core) family 6 model 58 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, ht
 
Memory: 4k page, physical 8285500k(5521920k free), swap 8283600k(5105872k free)
 
vm_info: Java HotSpot(TM) 64-Bit Server VM (20.6-b01) for windows-amd64 JRE (1.6.0_31-b05), built on Feb  3 2012 18:34:57 by "java_re" with MS VC++ 8.0 (VS2005)
 
time: Sat Sep 22 18:22:37 2012
elapsed time: 0 seconds
 
 
但是这个方法在非Android项目中时可以运行,而且是成功的,如下:
 
运行结果:
 
真是奇怪了。
posted on 2012-09-22 18:53  Fra~~kaka  阅读(2496)  评论(4编辑  收藏  举报