package com.gkhy.hazmat.admin;
|
|
import cn.hutool.core.codec.Base64;
|
import com.alibaba.fastjson2.JSONObject;
|
import com.gkhy.hazmat.common.utils.SecurityUtils;
|
import lombok.extern.slf4j.Slf4j;
|
import org.junit.Test;
|
import org.junit.runner.RunWith;
|
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.test.context.ActiveProfiles;
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
import java.util.Optional;
|
import java.util.Random;
|
|
@RunWith(SpringRunner.class)
|
@SpringBootTest(classes = GkhyAdminApplication.class)
|
@ActiveProfiles("dev")
|
@Slf4j
|
public class PasswordTest {
|
|
@Test
|
public void passwordGenerate(){
|
String password="Gkhy@c413";
|
String enpass= SecurityUtils.encryptPassword(password);
|
System.out.println(enpass);
|
System.out.println(Base64.encode(password));
|
|
// System.out.println(SecurityUtils.encryptPassword(password));
|
//
|
// String pp="R2toeUBjNDEz";
|
// System.out.println(SecurityUtils.encryptPassword(Base64.decodeStr(pp)));
|
}
|
|
@Test
|
public void testRand(){
|
Random random=new Random();
|
for(int i=0;i<10;i++) {
|
System.out.println(random.nextInt(20));
|
}
|
}
|
|
@Test
|
public void testJSon(){
|
String a="{\"a\":123}";
|
JSONObject jsonObject = JSONObject.parseObject(a);
|
System.out.println(a);
|
}
|
|
@Test
|
public void testData(){
|
System.out.println(testB());
|
|
}
|
|
public List<String> testB(){
|
List<String> b=new ArrayList<>();
|
List<String>aa=new ArrayList<>();
|
b.add("a");
|
b.add("b");
|
|
aa.addAll(b);
|
|
b.add("c");
|
return aa;
|
}
|
|
@Test
|
public void testNum(){
|
Integer a=null;
|
int b=0;
|
if(Optional.ofNullable(a).orElse(0)>b){
|
System.out.println("gggggg");
|
}else{
|
System.out.println("hhhhhh");
|
}
|
}
|
}
|