Q: Unit test in rest api (java + play framework) I have a REST api with java and play framework and I'm trying to make unit test for my controllers and services methods, but I cannot find how to do that.
Controller method example:
@Transactional(readOnly = true)
public Result findSomething(Optional<Integer> code) {
    List<Something> listSomething = SomethingService.find(code);
    return ok(Json.toJson(listSomething));
}

Service method example:
 public static List<Something> find(Optional<Integer> code) { 
    //DB stuff
    return JPA.em().createQuery(query).getResultList();
    }

When I tried to perform the unit test like what is explained in https://www.playframework.com/documentation/2.6.x/JavaTest, or with another web examples it allawys returning this exception:

java.lang.RuntimeException: No EntityManager bound to this thread. Try wrapping this call in JPAApi.withTransaction, or ensure that the HTTP context is setup on this thread

Anyone knows how to do it?
Thanks
