Need help with Junit for AEM code wherein we make a rest call and retrieve data
Hi All,
Code is as below :
public String execute(String url)
{
try{
HttpClient httpClient = new HttpClient();
httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(this.timeOut);
getMethod = new GetMethod(url);
String encoding = Base64.encode(this.name + ":" + this.password);
getMethod.setRequestHeader("Authorization", "Basic " + encoding);
int code = httpClient.executeMethod(getMethod);
....and so on.
}
The control is coming[when run as Junit test] till the line "getMethod.setRequestHeader("Authorization", "Basic " + encoding);" along with the error java.lang.LinkageError: loader constraint violation: loader (instance of org/powermock/core/classloader/MockClassLoader) previously initiated loading for a different type with name "javax/net/SocketFactory" and not going beyond it. Googled out and have been trying multiple options for the past one day, but no luck.
Any thoughts/pointers on how to solve this will be helpful.