package api;

import com.sunyard.chsm.param.GenRandomReq;
import com.sunyard.chsm.param.GenRandomResp;
import com.sunyard.chsm.utils.CodecUtils;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

/**
 * @author liulu
 * @since 2024/12/27
 */
@Slf4j
public class RandomTest extends BaseTest{



    @Test
    public void testRandom() {
        GenRandomReq randomReq = new GenRandomReq();
        randomReq.setLength(1024);
        GenRandomResp genRandomResp = execute("/gen/random", randomReq, GenRandomResp.class);
        Assertions.assertNotNull(genRandomResp);
        log.info("random: {}", genRandomResp.getRandom());
        byte[] bytes = CodecUtils.decodeBase64(genRandomResp.getRandom());
        Assertions.assertEquals(1024, bytes.length);

    }



}
