沈斌
2018-05-04 7234d03b3c51794c99c6bee8a617f9927898bd3f
src/test/java/com/moral/ScreenApiApplicationTests.java
@@ -3,7 +3,10 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
@RunWith(SpringRunner.class)
@SpringBootTest
@@ -12,5 +15,16 @@
   @Test
   public void contextLoads() {
   }
   @Resource
   private BCryptPasswordEncoder encoder;
   @Test
   public void testEncoder(){
      String hash = encoder.encode("123456");
      System.out.printf("\n============================\n");
      System.out.printf("hash:"+hash);
//      Boolean result = encoder.matches("123456",hash);
//      System.out.printf("result:"+result);
      System.out.printf("\n============================\n");
   }
}