package com.bonus.common.core.utils;

import org.junit.Test;

import java.net.URLDecoder;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

public class Base64UtilsTest {

    @Test
    public void testDecodeUrl() {
        String originString = "http://127.0.0.1:9300/statics/2024/10/30/网络拓扑图(6)_20241030171835A019.pdf";
       String decodeURL = "aHR0cDovLzEyNy4wLjAuMTo5MzAwL3N0YXRpY3MvMjAyNC8xMC8zMC%2FnvZHnu5zmi5PmiZHlm74oNilfMjAyNDEwMzAxNzE4MzVBMDE5LnBkZg%3D%3D";
       String decodeURL1 = "aHR0cDovLzEyNy4wLjAuMTo5MzAwL3N0YXRpY3MvMjAyNC8xMC8zMC/nvZHnu5zmi5PmiZHlm74oNilfMjAyNDEwMzAxNzE4MzVBMDE5LnBkZg==";
       String url  = Base64Utils.decodeUrl( URLDecoder.decode(decodeURL));
       String url1  = Base64Utils.decodeUrl( URLDecoder.decode(decodeURL1));
       assertEquals(originString, url);
       assertEquals(originString, url1);
    }

}
