单元测试由Junit4变更为Junit5

This commit is contained in:
Looly
2024-08-09 14:32:30 +08:00
parent 155c43a6a3
commit c7e0bc5d9f
568 changed files with 7794 additions and 7671 deletions

View File

@@ -2,9 +2,9 @@ package cn.hutool.captcha;
import cn.hutool.captcha.generator.MathGenerator;
import cn.hutool.core.lang.Console;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.awt.*;
@@ -19,12 +19,12 @@ public class CaptchaTest {
public void lineCaptchaTest1() {
// 定义图形验证码的长和宽
LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200, 100);
Assert.assertNotNull(lineCaptcha.getCode());
Assert.assertTrue(lineCaptcha.verify(lineCaptcha.getCode()));
assertNotNull(lineCaptcha.getCode());
assertTrue(lineCaptcha.verify(lineCaptcha.getCode()));
}
@Test
@Ignore
@Disabled
public void lineCaptchaTest3() {
// 定义图形验证码的长和宽
LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200, 70, 4, 15);
@@ -33,7 +33,7 @@ public class CaptchaTest {
}
@Test
@Ignore
@Disabled
public void lineCaptchaTestWithSize() {
// 定义图形验证码的长和宽
LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200, 70, 4, 15, 0.65f);
@@ -42,7 +42,7 @@ public class CaptchaTest {
}
@Test
@Ignore
@Disabled
public void lineCaptchaWithMathTest() {
// 定义图形验证码的长和宽
LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200, 80);
@@ -52,7 +52,7 @@ public class CaptchaTest {
}
@Test
@Ignore
@Disabled
public void lineCaptchaTest2() {
// 定义图形验证码的长和宽
@@ -72,7 +72,7 @@ public class CaptchaTest {
}
@Test
@Ignore
@Disabled
public void circleCaptchaTest() {
// 定义图形验证码的长和宽
@@ -86,7 +86,7 @@ public class CaptchaTest {
@Test
@Ignore
@Disabled
public void circleCaptchaTestWithSize() {
// 定义图形验证码的长和宽
CircleCaptcha captcha = CaptchaUtil.createCircleCaptcha(200, 70, 4, 15, 0.65f);
@@ -95,7 +95,7 @@ public class CaptchaTest {
}
@Test
@Ignore
@Disabled
public void shearCaptchaTest() {
// 定义图形验证码的长和宽
@@ -108,7 +108,7 @@ public class CaptchaTest {
}
@Test
@Ignore
@Disabled
public void shearCaptchaTest2() {
// 定义图形验证码的长和宽
@@ -120,7 +120,7 @@ public class CaptchaTest {
}
@Test
@Ignore
@Disabled
public void ShearCaptchaWithMathTest() {
// 定义图形验证码的长和宽
ShearCaptcha captcha = CaptchaUtil.createShearCaptcha(200, 45, 4, 4);
@@ -134,7 +134,7 @@ public class CaptchaTest {
@Test
@Ignore
@Disabled
public void ShearCaptchaTestWithSize() {
// 定义图形验证码的长和宽
ShearCaptcha captcha = CaptchaUtil.createShearCaptcha(200, 70, 4, 15, 0.65f);
@@ -143,7 +143,7 @@ public class CaptchaTest {
}
@Test
@Ignore
@Disabled
public void GifCaptchaTest() {
GifCaptcha captcha = CaptchaUtil.createGifCaptcha(200, 100, 4);
captcha.write("d:/test/gif_captcha.gif");
@@ -151,7 +151,7 @@ public class CaptchaTest {
}
@Test
@Ignore
@Disabled
public void GifCaptchaTestWithSize() {
// 定义图形验证码的长和宽
GifCaptcha captcha = CaptchaUtil.createGifCaptcha(200, 70, 4, 15, 0.65f);
@@ -160,7 +160,7 @@ public class CaptchaTest {
}
@Test
@Ignore
@Disabled
public void bgTest() {
LineCaptcha captcha = CaptchaUtil.createLineCaptcha(200, 100, 4, 1);
captcha.setBackground(Color.WHITE);

View File

@@ -4,8 +4,8 @@ import cn.hutool.core.img.GraphicsUtil;
import cn.hutool.core.img.ImgUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.awt.Color;
import java.awt.Graphics;
@@ -17,7 +17,7 @@ import java.util.concurrent.ThreadLocalRandom;
public class CaptchaUtilTest {
@Test
@Ignore
@Disabled
public void createTest() {
for(int i = 0; i < 1; i++) {
CaptchaUtil.createShearCaptcha(320, 240);
@@ -25,7 +25,7 @@ public class CaptchaUtilTest {
}
@Test
@Ignore
@Disabled
public void drawStringColourfulColorDistanceTest() {
for(int i = 0; i < 10; i++) {
AbstractCaptcha lineCaptcha = new TestLineCaptchaColorDistance(200, 100, 5, 10);
@@ -34,7 +34,7 @@ public class CaptchaUtilTest {
}
@Test
@Ignore
@Disabled
public void drawStringColourfulDefaultColorDistanceTest() {
for(int i = 0; i < 10; i++) {
AbstractCaptcha lineCaptcha = new TestLineCaptchaColorDistanceDefaultColorDistance(200, 100, 5, 10);

View File

@@ -1,7 +1,7 @@
package cn.hutool.captcha;
import cn.hutool.captcha.generator.MathGenerator;
import org.junit.Test;
import org.junit.jupiter.api.Test;
public class GeneratorTest {