shikeying
2024-01-11 3b67e947e36133e2a40eb2737b15ea375e157ea0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.walker.support.kaptcha;
 
import com.walker.web.CaptchaResult;
import org.junit.Test;
 
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
 
public class WordCaptchaMain {
 
//    @Test
    public void testWordCaptcha() throws Exception{
        WordCaptchaProvider wordCaptchaProvider = new WordCaptchaProvider();
        CaptchaResult result = wordCaptchaProvider.generateCaptcha(null);
 
        System.out.println("code = " + result.getCode());
 
        BufferedImage image = result.getImage();
        FileOutputStream fileOutputStream = new FileOutputStream(new File("d:/tmp/test.png"));
        ImageIO.write(image, "png", fileOutputStream);
    }
}