Я использую "тестовую платформу Джерси" для модульного тестирования моего веб-сервиса.
Вот мой класс ресурсов:
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
// The Java class will be hosted at the URI path "/helloworld"
@Path("/helloworld")
public class class HelloWorldResource {
private SomeService service;
@GET
@Produces("text/plain")
public String getClichedMessage() {
// Return some cliched textual content
String responseFromSomeService = service.getSomething();
return responseFromSomeService;
}
}
Как я могу издеваться над SomeService в модульных тестах?