Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Runtime error when JUnit testing

I am pretty shaky with Unit testing but I have a part of my code I really need to be certain of its consistency. I am attempting to transfer data from an object to an external file using JSON so I want to make sure when I pull the data from the external file it will be the same.

I am using a Unit test to assert this equality but I am encountering a problem I am not sure how to handle. It is a runtime error and this is what the console reads.

A fatal error has been detected by the Java Runtime Environment:

Internal Error (classFileParser.cpp:3494), pid=5032, tid=7048
Error: ShouldNotReachHere()

JRE version: 6.0_25-b06
Java VM: Java HotSpot(TM) 64-Bit Server VM (20.0-b11 mixed mode windows-amd64 compressed oops)
An error report file with more information is saved as:
L:\fliphouseWorkspace\Luas\hs_err_pid5032.log

If you would like to submit a bug report, please visit:
http://java.sun.com/webapps/bugreport/crash.jsp

Any help would be appreciated thanks.

like image 291
Hugs Avatar asked Jun 03 '11 12:06

Hugs


People also ask

Why is my JUnit test failing?

Example Failure When writing unit tests with JUnit, there will likely be situations when tests fail. One possibility is that our code does not meet its test criteria. That means one or more test cases fail due to assertions not being fulfilled.

How do you check if an exception is thrown JUnit?

When using JUnit 4, we can simply use the expected attribute of the @Test annotation to declare that we expect an exception to be thrown anywhere in the annotated test method. In this example, we've declared that we're expecting our test code to result in a NullPointerException.


2 Answers

If you are using Eclipse to develop an Android app, here's another possible explanation: http://independentlyemployed.co.uk/2010/11/17/worked-out-why/. (Apparently, this can also occur if you try / have tried to develop Android and regular Java in the same Eclipse Workspace; see https://stackoverflow.com/a/3223929/139985)

If you are not, then I think that the general problem is that the JVM is falling over while trying to parse (probably load) a class file. The most likely cause seems to be that the class file is mangled in some way. If that's the case, then this is not a JVM bug. The JVM may have no choice but to report this kind of problem via a crash report, because it could happen during JVM bootstrapping.


Here's an entry in the Java Bug Database that reports this: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7032077. Unfortunately, it has been closed as not reproducible.

like image 165
Stephen C Avatar answered Oct 06 '22 23:10

Stephen C


That's nothing to do with your code, that looks like a genuine JVM bug to me. The JVM should never crash like that. File a bug report with Oracle.

like image 36
Jeff Foster Avatar answered Oct 06 '22 22:10

Jeff Foster