Cobertura JUnit and HttpURLConnection

View: New views
1 Messages — Rating Filter:   Alert me  

Cobertura JUnit and HttpURLConnection

by wellwisher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am running a JUnit test with cobertura. I made sure JUnit is using the instrumented classes. The code makes HttpURLConnection to a website (google.com) for now. The moment it tries to make a physical connection (at getResponseCode()) the programs gets stuck forever.

Running the JUnit without Cobertura works well. Infact, running the program through a main() with Cobertura works too. But JUnit + Cobertura + HttpURLConnection does not seem to work.

I am attaching the relevant files.
CoberturaHTTPTest.java
build.xml

JDK: 1.6
JUnit: 4.4
Cobertura: 1.9

Let me know if you need anything else.
LightInTheBox - Buy quality products at wholesale price