ProblemStatusController { @GetMapping("problemstatus") @SuppressWarnings("AssignmentToMethodParameter") public String status(HttpServletRequest request, @RequestParam("problem_id") long id, @RequestParam(value = "language", required = false) Integer language, @PageableDefault(size = 20, sort = {"time", "memory", "code_length"}) Pageable pageable, @Nullable Authentication authentication) { log.debug("{}", pageable); if (pageable.getPageSize() > 500) { pageable = PageRequest.of(pageable.getPageNumber(), 500, pageable.getSort()); } Problem problem = problemService.findOneNoI18n(id); List<ScoreCount> list = submissionMapper.groupByScore(null, id); ArrayList<String> scores = new ArrayList<>(list.size()); ArrayList<Long> counts = new ArrayList<>(list.size()); ArrayList<String> urls = new ArrayList<>(list.size()); for (ScoreCount scoreCount : list) { int score = scoreCount.getScore(); scores.add(ResultType.getShowSourceString(score)); counts.add(scoreCount.getCount()); urls.add(request.getContextPath() + "/status?problem_id=" + id + "&score=" + score); } BestSubmissionForm form = BestSubmissionForm.builder() .problemId(id) .language(language) .build(); Page<Submission> page = submissionService.bestSubmission(form, pageable, problem.getSubmitUser()); boolean isAdmin = UserDetailsServiceImpl.isAdminLoginned(request); boolean isSourceBrowser = UserDetailsServiceImpl.isSourceBrowser(request); boolean canView = isAdmin || isSourceBrowser; request.setAttribute("page", page); request.setAttribute("sa", Arrays.asList(counts, scores, urls)); request.setAttribute("problem", problem); request.setAttribute("url", URIBuilder.fromRequest(request).replaceQueryParam("page").toString()); request.setAttribute("canView", canView); request.setAttribute("authentication", authentication); return "problems/status"; }  @GetMapping("gotoproblem") String gotoProblem(@RequestParam(value = "pid", required = false) String pid,
            RedirectAttributes redirectAttributes); @GetMapping("problemstatus") @SuppressWarnings("AssignmentToMethodParameter") String status(HttpServletRequest request,
            @RequestParam("problem_id") long id,
            @RequestParam(value = "language", required = false) Integer language,
            @PageableDefault(size = 20, sort = {"time", "memory", "code_length"}) Pageable pageable,
            @Nullable Authentication authentication);  }
@Test public void testStatus() throws Exception { log.info("status"); Problem problem = Problem.builder().contests(new long[]{0}).timeLimit(1000L).memoryLimit(65536L).build(); problemService.save(problem); long problemId = problem.getId(); MvcResult result = mvc.perform(get("/problemstatus").param("problem_id", Long.toString(problemId))) .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_HTML)) .andReturn(); }