I am writing JUnit test for one microservice developed with play-akka framework. In my JUnit class I need to write a test to check another REST endpoint by posting some sample data. I am using WsClient
for this but it gives me below compile error:
The type scala.Predef$$less$colon$less cannot be resolved. It is indirectly referenced from required .class files"
However the same way I am invoking the REST endpoint of another service from the microservice and it is working fine. Could you please throw some light what wrong in my code?
Below is the snippet:
private final WSClient _ws;
@Inject
public ReconciliationTest(final WSClient ws) {
this._ws = ws;
}
@Test
public void testRestCall() {
try {
WSRequest wsrequest = _ws
.url(IReconcileConst._API_URL)
.addHeader("Content-Type", "application/json")
.addHeader("cache-control", "no-cache")
.setMethod("POST");
jsonObj = Json.toJson(requestBean);
CompletionStage<WSResponse> respComplnStg = wsrequest.post(jsonObj);
resp = respComplnStg.toCompletableFuture().get();
} catch (Exception ex) {
ex.printStackTrace();
}
}
I am getting compile error at line:
CompletionStage<WSResponse> respComplnStg = wsrequest.post(jsonObj);