@Override
    protected CompletableFuture<LogListInfo> handleRequest(
            @Nonnull HandlerRequest<EmptyRequestBody> request,
            @Nonnull ResourceManagerGateway gateway)
            throws RestHandlerException {
        final ResourceID taskManagerId = request.getPathParameter(TaskManagerIdPathParameter.class);
        final ResourceManagerGateway resourceManagerGateway =
                getResourceManagerGateway(resourceManagerGatewayRetriever);
        final CompletableFuture<Collection<LogInfo>> logsWithLengthFuture =
                resourceManagerGateway.requestTaskManagerLogList(taskManagerId, timeout);

        return logsWithLengthFuture
                .thenApply(LogListInfo::new)
                .exceptionally(
                        (throwable) -> {
                            final Throwable strippedThrowable =
                                    ExceptionUtils.stripCompletionException(throwable);
                            if (strippedThrowable instanceof UnknownTaskExecutorException) {
                                throw new CompletionException(
                                        new RestHandlerException(
                                                "Could not find TaskExecutor " + taskManagerId,
                                                HttpResponseStatus.NOT_FOUND,
                                                strippedThrowable));
                            } else {
                                throw new CompletionException(throwable);
                            }
                        });
    }
@Test
    void testGetTaskManagerLogsList() throws Exception {
        List<LogInfo> logsList =
                Arrays.asList(
                        new LogInfo("taskmanager.log", 1024L, 1632844800000L),
                        new LogInfo("taskmanager.out", 1024L, 1632844800000L),
                        new LogInfo("taskmanager-2.out", 1024L, 1632844800000L));
        resourceManagerGateway.setRequestTaskManagerLogListFunction(
                EXPECTED_TASK_MANAGER_ID -> CompletableFuture.completedFuture(logsList));
        LogListInfo logListInfo =
                taskManagerLogListHandler
                        .handleRequest(handlerRequest, resourceManagerGateway)
                        .get();
        assertThat(logListInfo.getLogInfos()).containsExactlyInAnyOrderElementsOf(logsList);
    }