How to mock java.util.base64 methods using mockito
How to mock java.util.base64 methods using mockito I have REST API which returns json response i am writing test case for the REST api method using mockito There is a xml response in the json so i am trying to encode the xml string in the json using Base64 My test case throws null pointer exception while executing the Base64.encode line in the REST api method I cant use powermockito , its not used in the organisation how can i fix this issue using mockito itself below is the line of code which throws error Base64.getEncoder().encodeToString((message)).getBytes(StandardCharsets.UTF_8); Here message is the xml string . 1 Answer 1 Are you sure you have to embed your XML in your JSON? Perhaps it would make for an easier API if you could transform your XML to JSON and not encode anything? But, If you're sure you have to have XML nested in JSON, then you should pass Base64.getEncoder() result as you...
