PowerMock 下,调用JAR包中的Class的getResourceAsStream()会出问题

  If

    1. a JUnit test is run with PowerMock,

    2. and this test calls "this.getClass().getResourceAsStream()",

    3. and this test class is loaded in a jar file, instead of being loaded as a single file

  Then

    A "java.net.MalformedURLException" will be thrown at this.getClass().getResourceAsStream() when this test is invoked.

 

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.