Как проверить конечную точку Джерси без дополнительных платформ - PullRequest
0 голосов
/ 28 января 2020

Я разрабатываю конечные точки jersey, и мне нужно выполнить интеграционный тест для этих конечных точек, я сомневаюсь, как можно выполнить модульный тест для этой конечной точки без добавления дополнительных зависимостей в pom или дополнительные библиотеки, поскольку это ограничение. Есть способ добиться этого? Я использую junit версии 5. Это пример моей конечной точки. Я использовал jerseyTest, но мне пришлось отменить изменения из-за ограничения:

@GET
@Path("/")
@ApiResponses(value = {
        @ApiResponse(code = SC_OK, response = HorasPaginatedResult.class,
                message = "Successfully retrievedHoras from Labor Service"),
        @ApiResponse(code = SC_BAD_REQUEST, response = ErrorMessage.class, message = "The request was malformed or missing a required field"),
        @ApiResponse(code = SC_INTERNAL_SERVER_ERROR, response = ErrorMessage.class, message = "There was an issue processing the request and the server has failed out of the action"),
})
@ApiOperation(value = "Used to query the time service for timeclocks.",
        response = HorasPaginatedResult.class,
        tags = "Horas",
        nickname = "get-Horas.all")
public PaginatedResult<Horas> getHorasAll(
        @Nullable @ApiParam("the token to the next page of results") @QueryParam("token") String token,
        @Nullable @ApiParam(value = "the field to sort by - this may through a 500 error if the index does not exsist", example = "timestamp") @QueryParam("sortBy") String sortBy,
        @Nullable @ApiParam("boolean to determine which direction the sort should be in") @QueryParam("sortAscending") Boolean sortAscending,
        @Nullable @ApiParam("the maximum number of 'records' to return per page") @QueryParam("recordLimit") Integer recordLimit,
        @Nullable @ApiParam(value = "object", example = "%7B%22field%22%") @QueryParam("expression") List<Query.Expression> expressions) {
    Query query;
    if (token != null) {
        query = new Query(token);
    } else {
        query = new Query(sortBy, recordLimit, sortAscending);
        if (expressions != null) {
            expressions.forEach(query.getExpressions()::add);
        }
    }
    logger.info("creating query of {}", query);
    return HorasService.getHoras(query);
}


private static class HorasPaginatedResult extends PaginatedResult<BanquetLaborHoras> {

}

Есть идеи?

...