Closed manusaxena closed 9 years ago
I executed a JUnit test suite containing @Mocked fields for URL and HttpURLConnection, from IntelliJ IDEA, Maven, and Ant. But there was no NullPointerException at the end, and the coverage report got correctly generated in each case.
Hello,
I am using jmockit latest release in project and coverage report is getting failed due mock url class. i read the release history and saying that issue is already resolved but i am getting here. I am placing ant error log here. any sort of help would be appreciated.
[junit] Exception in thread "Thread-0" java.lang.NullPointerException [junit] at java.io.File.(File.java:251)
[junit] at mockit.coverage.modification.ClassesNotLoaded.gatherCoverageData(ClassesNotLoaded.java:28)
[junit] at mockit.coverage.OutputFileGenerator.generate(OutputFileGenerator.java:82)
[junit] at mockit.coverage.CodeCoverage$1.run(CodeCoverage.java:67)
Here is the test class for reference.
@RunWith(JMockit.class) public class GetImagesServiceTest extends BaseUnitTestCase {
*/ @Test public void testRejectDomain() throws MalformedURLException { String url; URL urlOb; url = "http://www.googlesyndication.com/test/apc"; urlOb = new URL(url); mockHost(urlOb, "www.googlesyndication.com"); Assert.assertFalse(GetImagesService.checkImage(urlOb)); url = "http://www.doubleclick.net/test/apc"; urlOb = new URL(url); mockHost(urlOb, "www.doubleclick.net"); Assert.assertFalse(GetImagesService.checkImage(urlOb)); url = "http://www.scorecardresearch.com/test/apc"; urlOb = new URL(url); mockHost(urlOb, "www.scorecardresearch.com"); Assert.assertFalse(GetImagesService.checkImage(urlOb)); url = "http://www35.glam.com/test/apc"; urlOb = new URL(url); mockHost(urlOb, "www35.glam.com"); Assert.assertFalse(GetImagesService.checkImage(urlOb));
}
ANT call for test