package cn.edu.zjnu.acm.judge.controller.user;

import cn.edu.zjnu.acm.judge.Application;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.transaction.annotation.Transactional;

import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

@AutoConfigureMockMvc
@RunWith(SpringRunner.class)
@Slf4j
@SpringBootTest(classes = Application.class)
@Transactional
@WebAppConfiguration
public class UserListControllerTest {

    @Autowired
    private MockMvc mvc;

    /**
     * Test of userList method, of class UserListController.
     *
     * @see UserListController#userList(HttpServletRequest, Pageable)
     */
    @Test
    public void testUserList() throws Exception {
        log.info("userList");
        MvcResult result = mvc.perform(get("/userlist"))
                .andExpect(status().isOk())
                .andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_HTML))
                .andReturn();
    }

}

@@ -79,24 +79,170 @@
 pplication;%0A
+import cn.edu.zjnu.acm.judge.service.MockDataService;%0Aimport cn.edu.zjnu.acm.judge.util.JudgeUtils;%0Aimport javax.servlet.http.HttpServletRequest;%0A
 import lombo
@@ -263,16 +263,16 @@
 .Slf4j;%0A
-
 import o
@@ -524,24 +524,73 @@
 ngBootTest;%0A
+import org.springframework.data.domain.Pageable;%0A
 import org.s
@@ -1402,16 +1402,76 @@
 Mvc mvc;
+%0A    @Autowired%0A    private MockDataService mockDataService;
 %0A%0A    /*
@@ -1610,16 +1610,60 @@
 geable)%0A
+     * @see JudgeUtils#sequence(long, long)%0A
      */%0A
@@ -1752,16 +1752,16 @@
 List%22);%0A
-
         
@@ -1968,16 +1968,308 @@
 turn();%0A
+        for (int i = 0; i %3C 105; i++) %7B%0A            mockDataService.user();%0A        %7D%0A        result = mvc.perform(get(%22/userlist%22))%0A                .andExpect(status().isOk())%0A                .andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_HTML))%0A                .andReturn();%0A
     %7D%0A%0A%7D

Test JudgeUtils.sequence