ServiceImplTest.java 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package com.qs.mp.service;
  2. import com.qs.mp.MpApplication;
  3. import com.qs.mp.admin.service.ITicketBoxSerialService;
  4. import com.qs.mp.framework.service.IWxUrlLinkService;
  5. import org.junit.jupiter.api.Test;
  6. import org.slf4j.Logger;
  7. import org.slf4j.LoggerFactory;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
  10. import org.springframework.boot.test.context.SpringBootTest;
  11. import org.springframework.test.context.ActiveProfiles;
  12. import org.springframework.test.context.TestPropertySource;
  13. /**
  14. * @author zhongcp
  15. * @Date 2021/8/31
  16. */
  17. @AutoConfigureMockMvc
  18. @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = MpApplication.class)
  19. @TestPropertySource(locations = "classpath:application-dev.yml")
  20. @ActiveProfiles("dev")
  21. public class ServiceImplTest {
  22. protected final Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
  23. @Autowired
  24. private IWxUrlLinkService wxUrlLinkService;
  25. @Autowired
  26. private ITicketBoxSerialService ticketBoxSerialService;
  27. @Test
  28. public void testGenerateQrCode() {
  29. System.out.println(wxUrlLinkService.generateCode("pages/login/invitation", "id=1&type=salesite", "wxc3a684f1196f6e15"));
  30. }
  31. @Test
  32. public void testGenerateUrlSchema() {
  33. System.out.println(wxUrlLinkService.generateUrlSchema("/pages/deposit/index", "", "wxb86cb7f459fc3675"));
  34. }
  35. @Test
  36. public void testGenerateSerial() {
  37. System.out.println(ticketBoxSerialService.generateSerial(null));
  38. }
  39. public static void main(String[] args) {
  40. /*int n = 500;
  41. Random rand = new Random();
  42. boolean[] bool = new boolean[n];
  43. int randInt = 0;
  44. for(int i = 0; i < 50 ; i++) {
  45. do {
  46. randInt = rand.nextInt(n);
  47. }while(bool[randInt]);
  48. bool[randInt] = true;
  49. System.out.println(randInt);
  50. }
  51. */
  52. String s = "z";
  53. int i = Character.codePointAt(s, 0);
  54. System.out.println(i + "");
  55. char[] a = Character.toChars(72);
  56. System.out.println(new String(a));
  57. }
  58. }