| @@ -1,47 +0,0 @@ | |||||
| package com.iformall.test; | |||||
| import com.iformall.CApplication; | |||||
| import com.iformall.domain.po.WxLevelConfig; | |||||
| import com.iformall.service.WxLevelConfigService; | |||||
| import org.junit.Before; | |||||
| import org.junit.Test; | |||||
| import org.junit.runner.RunWith; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.boot.test.context.SpringBootTest; | |||||
| 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.setup.MockMvcBuilders; | |||||
| import org.springframework.web.context.WebApplicationContext; | |||||
| import java.util.List; | |||||
| @RunWith(SpringRunner.class) | |||||
| @SpringBootTest(classes = CApplication.class)//这里的Application是springboot的启动类名 | |||||
| @WebAppConfiguration | |||||
| public class appTest { | |||||
| @Autowired | |||||
| private WebApplicationContext wac; | |||||
| private MockMvc mockMvc; | |||||
| @Autowired | |||||
| WxLevelConfigService wxLevelConfigService; | |||||
| @Before | |||||
| public void setupMockMvc() throws Exception { | |||||
| mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); | |||||
| } | |||||
| @Test | |||||
| public void testSend() throws Exception { | |||||
| Integer score = 2055; | |||||
| List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantId("456"); | |||||
| for (WxLevelConfig levelConfig : levelList) { | |||||
| if (score >= levelConfig.getPoints()) { | |||||
| System.out.println(levelConfig.getLevel()); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||