Today met the following questions when writing UT:
powermock 1. static method used to process;
2. where there is a static method using the method org.apache.http.client (4.3.1) of
Abnormal follows:
Caused by: org.apache.http.conn.ssl.SSLInitializationException: class configured for SSLContext: sun.security.ssl.SSLContextImpl$TLS10Context not a SSLContext at org.apache.http.conn.ssl.SSLContexts.createDefault(SSLContexts.java:58) at org.apache.http.conn.ssl.SSLSocketFactory.getSocketFactory(SSLSocketFactory.java:162) at com.taobao.tae.security.topscan.TaeTopScanClient.<clinit>(TaeTopScanClient.java:73) ... 37 more Caused by: java.security.NoSuchAlgorithmException: class configured for SSLContext: sun.security.ssl.SSLContextImpl$TLS10Context not a SSLContext at sun.security.jca.GetInstance.checkSuperClass(GetInstance.java:258) at sun.security.jca.GetInstance.getInstance(GetInstance.java:237) at sun.security.jca.GetInstance.getInstance(GetInstance.java:164) at javax.net.ssl.SSLContext.getInstance(SSLContext.java:156) at org.apache.http.conn.ssl.SSLContexts.createDefault(SSLContexts.java:54) ... 39 more
google a bit, not that version or package should be no problem, the problem powermock mechanism.
Solution:
Increase annotation on UTclass:
@PowerMockIgnore("javax.net.ssl.*")