cwf23 4 years ago
parent
commit
369ddd2432

+ 0 - 46
src/test/java/com/tofly/river/controller/Base64.java

@@ -1,46 +0,0 @@
-package com.tofly.river.controller;
-
-import org.junit.Test;
-import sun.misc.BASE64Decoder;
-import sun.misc.BASE64Encoder;
-
-import java.io.UnsupportedEncodingException;
-
-public class Base64 {
-    // 加密6
-    public static String encode(String str) {
-        byte[] b = null;
-        String s = null;
-        try {
-            b = str.getBytes("utf-8");
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-        if (b != null) {
-            s = new BASE64Encoder().encode(b);
-        }
-        return s;
-    }
-
-    // 解密
-    public static String decode(String s) {
-        byte[] b = null;
-        String result = null;
-        if (s != null) {
-            BASE64Decoder decoder = new BASE64Decoder();
-            try {
-                b = decoder.decodeBuffer(s);
-                result = new String(b, "utf-8");
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-        return result;
-    }
-
-    @Test
-    public void test() {
-        System.out.println(encode("111111111111111111"));
-        System.out.println(encode("123456"));
-    }
-}

+ 0 - 28
src/test/java/com/tofly/river/controller/Test.java

@@ -1,28 +0,0 @@
-package com.tofly.river.controller;
-
-import cn.hutool.core.codec.Base64Encoder;
-import org.apache.logging.log4j.util.Base64Util;
-import org.junit.runner.RunWith;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.util.Base64Utils;
-
-/**
- * author:cwf
- * date:2021/4/8
- * time:15:31
- * version:1.0
- */
-
-public class Test {
-
-
-    @org.junit.Test
-    public void tes() {
-        byte[] encode = Base64Utils.encode("111111111111111111".getBytes());
-        System.out.println(new String(encode));
-        String encode1 = Base64Util.encode("");
-        System.out.println(encode1);
-
-    }
-}