I am writing a JUnit5 test case for a servlet that is creating a JsonObject object. While running the test case in my IDE (IntelliJ), I'm getting the below error -
But, on the other hand, my core package build is successful. How to get this error resolved in my IDE as I can see that the dependency jar is getting downloaded while maven build.
Solved! Go to Solution.
Views
Replies
Total Likes
Hello @goyalkritika -
Couple of things, did you validated the following :
<dependency>
<groupId>com.google.code.gson<groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
<scope>test</scope>
</dependency>
Hi @goyalkritika ,
Looks like IDE specific error. you could try the following.
Also check this thread on the stack, https://stackoverflow.com/questions/51489823/noclassdeffounderror-when-trying-to-execute-junit-4-tes...
Hope this helps!
Regards,
Nitesh
Hi @goyalkritika ,
This could happen due to a missing JAR file or JAR was not added into classpath or sometimes jar's name has been changed.
What you would need to do is that delete your existing m2 repo and try to build the code again, and see if you still getting this error.
Hello @goyalkritika -
Couple of things, did you validated the following :
<dependency>
<groupId>com.google.code.gson<groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
<scope>test</scope>
</dependency>
Views
Likes
Replies
Views
Likes
Replies