PowerMock PrepareForTest annotation causing problems with AmazonSQSClient constructor

后端 未结 2 1445
盖世英雄少女心
盖世英雄少女心 2020-12-10 06:11

I\'m having some trouble with the PrepareForTest annotation and creating a new instance of an AmazonSQSClient.

I\'m writing a Jenkins plugin and unfortunately need t

2条回答
  •  既然无缘
    2020-12-10 07:10

    As @Natalie already mentioned, you can work with the @PowerMockIgnore() annotation. Maybe you need to ignore the packages javax.net.ssl.* and / or javax.crypto.*:

    @PowerMockIgnore({"org.apache.http.conn.ssl.*", "javax.net.ssl.*" , "javax.crypto.*"})
    

    You can get here some background information:

    https://groups.google.com/forum/#!topic/powermock/v4nreP2AnOQ

    This is most likely because SSLContext is loaded by the bootstrap classloader and PowerMock cannot byte-code manipulate these classes. You have to use this approach to mock that method. /Johan Haleby

提交回复
热议问题