I subclassed javax.net.ssl.X509TrustManager so I could use a private SSL cert. Now I am trying to write a JUnit test for my class, but the test cases keep giving me a null pointer exception.
E.g. my implementation of checkClientTrusted() is an empty method. However, when I call that method with a (supposedly) valid instance of X509Certificate[] (and any sort of String for that matter), JUnit reports a NullException at that line of test code. Any suggestions as to what I am missing?
The problem was I subclassed my test class from
junit.framework.TestCase, which caused my@BeforeClasssetup method not to get called (and therefore the variables I instantiated there were still null). After deleting that, things are working now.