package com.qs.mp.service; import com.qs.mp.MpApplication; import com.qs.mp.admin.service.ITicketBoxSerialService; import com.qs.mp.framework.service.IWxUrlLinkService; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; /** * @author zhongcp * @Date 2021/8/31 */ @AutoConfigureMockMvc @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = MpApplication.class) @TestPropertySource(locations = "classpath:application-dev.yml") @ActiveProfiles("dev") public class ServiceImplTest { protected final Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName()); @Autowired private IWxUrlLinkService wxUrlLinkService; @Autowired private ITicketBoxSerialService ticketBoxSerialService; @Test public void testGenerateQrCode() { System.out.println(wxUrlLinkService.generateCode("pages/login/invitation", "id=1&type=salesite", "wxc3a684f1196f6e15")); } @Test public void testGenerateUrlSchema() { System.out.println(wxUrlLinkService.generateUrlSchema("/pages/deposit/index", "", "wxb86cb7f459fc3675")); } @Test public void testGenerateSerial() { System.out.println(ticketBoxSerialService.generateSerial(null)); } public static void main(String[] args) { /*int n = 500; Random rand = new Random(); boolean[] bool = new boolean[n]; int randInt = 0; for(int i = 0; i < 50 ; i++) { do { randInt = rand.nextInt(n); }while(bool[randInt]); bool[randInt] = true; System.out.println(randInt); } */ String s = "z"; int i = Character.codePointAt(s, 0); System.out.println(i + ""); char[] a = Character.toChars(72); System.out.println(new String(a)); } }