EncryptUtilsTest.java 698 B

123456789101112131415161718192021222324252627282930313233
  1. package me.zhengjie.utils;
  2. import org.junit.jupiter.api.Test;
  3. import static me.zhengjie.utils.EncryptUtils.*;
  4. import static org.junit.jupiter.api.Assertions.assertEquals;
  5. public class EncryptUtilsTest {
  6. /**
  7. * 对称加密
  8. */
  9. @Test
  10. public void testDesEncrypt() {
  11. try {
  12. assertEquals("7772841DC6099402", desEncrypt("123456"));
  13. } catch (Exception e) {
  14. e.printStackTrace();
  15. }
  16. }
  17. /**
  18. * 对称解密
  19. */
  20. @Test
  21. public void testDesDecrypt() {
  22. try {
  23. assertEquals("123456", desDecrypt("7772841DC6099402"));
  24. } catch (Exception e) {
  25. e.printStackTrace();
  26. }
  27. }
  28. }