SPRINGJUNIT4 test--Test unresponsive/console report NULL pointer resolution---JUNIT JAR conflict!

Source: Internet
Author: User
Objective:

A few days ago encountered a strange problem-with springjunit test, the operation of the method of what reaction is not, the console also has no output, Baidu has no answer-had to temporarily forget. today I had to use the elimination method, to build a small test project, as long as a few spring related jar can be tested in, test normal, and then began to compare with the original project to exclude the jar, to see in the end is which/which jars caused the jar conflict, The result was beyond my expectation-even my own brother! Originally this project also has a junit-4.4 jar, delete it just fine. (When the project build path adds a junt4 dependency, it imports the appropriate jar and conflicts with it.) ) hey ... I directly enlarge the recruit, wasting vitality. Since it's a test exception, how can I start thinking about testing jar conflicts? In that case, a minute is almost ready--it's the biggest thought.

The following is a description of the problem and troubleshooting and resolution procedures:

Problem Description:

Springjunit tested a method, found that the console reported a null pointer (which was later reported, was blank at first, and nothing), and the JUnit program did not respond.

Null pointer exception Analysis for the console report:

Right-click into the jar where the exception is located (I have installed the anti-compilation, if the item exists the jar is absolutely accessible.) ), found below the purple box in the method where the class is not found!

Such as:

Is it the eclipse (I'm using STS, like Eclipse)?

But I can test it with other projects. This is certainly not a tool problem. caused by--jar.

Next I'll add a jar to the normal test project and see where to add it, and finally check out the pit cargo:

WORKAROUND: Delete the jar.

PostScript: may also be related to the tool. Since the development was myeclipse, now I am using eclipse, so it is not ruled out that MyEclipse can test this possibility.

SPRINGJUNIT4 test--Test unresponsive/console report NULL pointer resolution---JUNIT JAR conflict!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.