mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
update to junit5
This commit is contained in:
@@ -2,13 +2,13 @@ package cn.hutool.swing;
|
||||
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.swing.clipboard.ClipboardUtil;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ClipboardMonitorTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void monitorTest() {
|
||||
// 第一个监听
|
||||
ClipboardUtil.listen((clipboard, contents) -> {
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package cn.hutool.swing;
|
||||
|
||||
import cn.hutool.swing.clipboard.ClipboardUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* 剪贴板工具类单元测试
|
||||
@@ -18,7 +18,7 @@ public class ClipboardUtilTest {
|
||||
ClipboardUtil.setStr("test");
|
||||
|
||||
final String test = ClipboardUtil.getStr();
|
||||
Assert.assertEquals("test", test);
|
||||
Assertions.assertEquals("test", test);
|
||||
} catch (final java.awt.HeadlessException e) {
|
||||
// 忽略 No X11 DISPLAY variable was set, but this program performed an operation which requires it.
|
||||
// ignore
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package cn.hutool.swing;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class DesktopUtilTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void browseTest() {
|
||||
DesktopUtil.browse("https://www.hutool.club");
|
||||
}
|
||||
|
@@ -1,13 +1,13 @@
|
||||
package cn.hutool.swing;
|
||||
|
||||
import cn.hutool.core.io.file.FileUtil;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class RobotUtilTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void captureScreenTest() {
|
||||
RobotUtil.captureScreen(FileUtil.file("e:/screen.jpg"));
|
||||
}
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package cn.hutool.swing.captcha;
|
||||
|
||||
import cn.hutool.swing.captcha.generator.MathGenerator;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import cn.hutool.swing.captcha.generator.MathGenerator;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
|
||||
/**
|
||||
* 直线干扰验证码单元测试
|
||||
@@ -19,12 +19,12 @@ public class CaptchaTest {
|
||||
public void lineCaptchaTest1() {
|
||||
// 定义图形验证码的长和宽
|
||||
final LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200, 100);
|
||||
Assert.assertNotNull(lineCaptcha.getCode());
|
||||
Assert.assertTrue(lineCaptcha.verify(lineCaptcha.getCode()));
|
||||
Assertions.assertNotNull(lineCaptcha.getCode());
|
||||
Assertions.assertTrue(lineCaptcha.verify(lineCaptcha.getCode()));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void lineCaptchaTest3() {
|
||||
// 定义图形验证码的长和宽
|
||||
final LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200, 70, 4, 15);
|
||||
@@ -33,7 +33,7 @@ public class CaptchaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void lineCaptchaWithMathTest() {
|
||||
// 定义图形验证码的长和宽
|
||||
final LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200, 80);
|
||||
@@ -43,7 +43,7 @@ public class CaptchaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void lineCaptchaTest2() {
|
||||
|
||||
// 定义图形验证码的长和宽
|
||||
@@ -63,7 +63,7 @@ public class CaptchaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void circleCaptchaTest() {
|
||||
|
||||
// 定义图形验证码的长和宽
|
||||
@@ -76,7 +76,7 @@ public class CaptchaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void shearCaptchaTest() {
|
||||
|
||||
// 定义图形验证码的长和宽
|
||||
@@ -89,7 +89,7 @@ public class CaptchaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void shearCaptchaTest2() {
|
||||
|
||||
// 定义图形验证码的长和宽
|
||||
@@ -101,7 +101,7 @@ public class CaptchaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void ShearCaptchaWithMathTest() {
|
||||
// 定义图形验证码的长和宽
|
||||
final ShearCaptcha captcha = CaptchaUtil.createShearCaptcha(200, 45, 4, 4);
|
||||
@@ -114,7 +114,7 @@ public class CaptchaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void GifCaptchaTest() {
|
||||
final GifCaptcha captcha = CaptchaUtil.createGifCaptcha(200, 100, 4);
|
||||
captcha.write("d:/test/gif_captcha.gif");
|
||||
@@ -122,7 +122,7 @@ public class CaptchaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void bgTest(){
|
||||
final LineCaptcha captcha = CaptchaUtil.createLineCaptcha(200, 100, 4, 1);
|
||||
captcha.setBackground(Color.WHITE);
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package cn.hutool.swing.captcha;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class CaptchaUtilTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void createTest() {
|
||||
for(int i = 0; i < 1; i++) {
|
||||
CaptchaUtil.createShearCaptcha(320, 240);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package cn.hutool.swing.captcha;
|
||||
|
||||
import cn.hutool.swing.captcha.generator.MathGenerator;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class GeneratorTest {
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package cn.hutool.swing.img;
|
||||
|
||||
import cn.hutool.swing.img.color.ColorUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
@@ -11,18 +11,18 @@ public class ColorUtilTest {
|
||||
@Test
|
||||
public void getColorTest(){
|
||||
final Color blue = ColorUtil.getColor("blue");
|
||||
Assert.assertEquals(Color.BLUE, blue);
|
||||
Assertions.assertEquals(Color.BLUE, blue);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toCssRgbTest(){
|
||||
final String s = ColorUtil.toCssRgb(Color.BLUE);
|
||||
Assert.assertEquals("rgb(0,0,255)", s);
|
||||
Assertions.assertEquals("rgb(0,0,255)", s);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toCssRgbaTest(){
|
||||
final String s = ColorUtil.toCssRgba(Color.BLUE);
|
||||
Assert.assertEquals("rgba(0,0,255,1.0)", s);
|
||||
Assertions.assertEquals("rgba(0,0,255,1.0)", s);
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package cn.hutool.swing.img;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.awt.Font;
|
||||
|
||||
@@ -10,6 +10,6 @@ public class FontUtilTest {
|
||||
@Test
|
||||
public void createFontTest(){
|
||||
final Font font = FontUtil.createFont();
|
||||
Assert.assertNotNull(font);
|
||||
Assertions.assertNotNull(font);
|
||||
}
|
||||
}
|
||||
|
@@ -3,8 +3,8 @@ package cn.hutool.swing.img;
|
||||
import cn.hutool.core.io.file.FileTypeUtil;
|
||||
import cn.hutool.core.io.file.FileUtil;
|
||||
import cn.hutool.core.net.url.URLUtil;
|
||||
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.Font;
|
||||
@@ -15,32 +15,32 @@ import java.io.File;
|
||||
public class ImgTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void cutTest1() {
|
||||
Img.from(FileUtil.file("e:/pic/face.jpg")).cut(0, 0, 200).write(FileUtil.file("e:/pic/face_radis.png"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void compressTest() {
|
||||
Img.from(FileUtil.file("f:/test/4347273249269e3fb272341acc42d4e.jpg")).setQuality(0.8).write(FileUtil.file("f:/test/test_dest.jpg"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void writeTest() {
|
||||
final Img from = Img.from(FileUtil.file("d:/test/81898311-001d6100-95eb-11ea-83c2-a14d7b1010bd.png"));
|
||||
ImgUtil.write(from.getImg(), FileUtil.file("d:/test/dest.jpg"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void roundTest() {
|
||||
Img.from(FileUtil.file("e:/pic/face.jpg")).round(0.5).write(FileUtil.file("e:/pic/face_round.png"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void pressTextTest() {
|
||||
Img.from(FileUtil.file("d:/test/617180969474805871.jpg"))
|
||||
.setPositionBaseCentre(false)
|
||||
@@ -54,7 +54,7 @@ public class ImgTest {
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void pressTextFullScreenTest() {
|
||||
Img.from(FileUtil.file("d:/test/1435859438434136064.jpg"))
|
||||
.setTargetImageType(ImgUtil.IMAGE_TYPE_PNG)
|
||||
@@ -68,7 +68,7 @@ public class ImgTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void pressImgTest() {
|
||||
Img.from(FileUtil.file("d:/test/图片1.JPG"))
|
||||
.pressImage(ImgUtil.read("d:/test/617180969474805871.jpg"), new Rectangle(0, 0, 800, 800), 1f)
|
||||
@@ -76,7 +76,7 @@ public class ImgTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void strokeTest() {
|
||||
Img.from(FileUtil.file("d:/test/公章3.png"))
|
||||
.stroke(null, 2f)
|
||||
@@ -87,7 +87,7 @@ public class ImgTest {
|
||||
* issue#I49FIU
|
||||
*/
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void scaleTest() {
|
||||
final String downloadFile = "d:/test/1435859438434136064.JPG";
|
||||
final File file = FileUtil.file(downloadFile);
|
||||
@@ -98,7 +98,7 @@ public class ImgTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void rotateWithBackgroundTest() {
|
||||
Img.from(FileUtil.file("d:/test/aaa.jpg"))
|
||||
.setBackgroundColor(Color.RED)
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package cn.hutool.swing.img;
|
||||
|
||||
import cn.hutool.core.io.file.FileUtil;
|
||||
import cn.hutool.core.io.IORuntimeException;
|
||||
import cn.hutool.core.io.file.FileUtil;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.swing.img.color.ColorUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.Color;
|
||||
@@ -22,13 +22,13 @@ import java.net.URL;
|
||||
public class ImgUtilTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void scaleTest() {
|
||||
ImgUtil.scale(FileUtil.file("e:/pic/test.jpg"), FileUtil.file("e:/pic/test_result.jpg"), 0.8f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void scaleTest2() {
|
||||
ImgUtil.scale(
|
||||
FileUtil.file("d:/test/2.png"),
|
||||
@@ -36,38 +36,38 @@ public class ImgUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void scalePngTest() {
|
||||
ImgUtil.scale(FileUtil.file("f:/test/test.png"), FileUtil.file("f:/test/test_result.png"), 0.5f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void scaleByWidthAndHeightTest() {
|
||||
ImgUtil.scale(FileUtil.file("f:/test/aaa.jpg"), FileUtil.file("f:/test/aaa_result.jpg"), 100, 400, Color.BLUE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void cutTest() {
|
||||
ImgUtil.cut(FileUtil.file("d:/face.jpg"), FileUtil.file("d:/face_result.jpg"), new Rectangle(200, 200, 100, 100));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void rotateTest() throws IOException {
|
||||
final Image image = ImgUtil.rotate(ImageIO.read(FileUtil.file("e:/pic/366466.jpg")), 180);
|
||||
ImgUtil.write(image, FileUtil.file("e:/pic/result.png"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void flipTest() {
|
||||
ImgUtil.flip(FileUtil.file("d:/logo.png"), FileUtil.file("d:/result.png"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void pressImgTest() {
|
||||
ImgUtil.pressImage(
|
||||
FileUtil.file("d:/test/1435859438434136064.jpg"),
|
||||
@@ -76,7 +76,7 @@ public class ImgUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void pressTextTest() {
|
||||
ImgUtil.pressText(//
|
||||
FileUtil.file("d:/test/2.jpg"), //
|
||||
@@ -89,33 +89,33 @@ public class ImgUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void sliceByRowsAndColsTest() {
|
||||
ImgUtil.sliceByRowsAndCols(FileUtil.file("d:/test/logo.jpg"), FileUtil.file("d:/test/dest"), ImgUtil.IMAGE_TYPE_JPEG, 1, 5);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void convertTest() {
|
||||
ImgUtil.convert(FileUtil.file("e:/test2.png"), FileUtil.file("e:/test2Convert.jpg"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void writeTest() {
|
||||
final byte[] bytes = ImgUtil.toBytes(ImgUtil.read("d:/test/logo_484.png"), "png");
|
||||
FileUtil.writeBytes(bytes, "d:/test/result.png");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void compressTest() {
|
||||
ImgUtil.compress(FileUtil.file("d:/test/dest.png"),
|
||||
FileUtil.file("d:/test/1111_target.jpg"), 0.1f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void copyTest() {
|
||||
final BufferedImage image = ImgUtil.copyImage(ImgUtil.read("f:/pic/test.png"), BufferedImage.TYPE_INT_RGB);
|
||||
ImgUtil.write(image, FileUtil.file("f:/pic/test_dest.jpg"));
|
||||
@@ -124,11 +124,11 @@ public class ImgUtilTest {
|
||||
@Test
|
||||
public void toHexTest(){
|
||||
final String s = ColorUtil.toHex(Color.RED);
|
||||
Assert.assertEquals("#FF0000", s);
|
||||
Assertions.assertEquals("#FF0000", s);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void backgroundRemovalTest() {
|
||||
// 图片 背景 换成 透明的
|
||||
ImgUtil.backgroundRemoval(
|
||||
@@ -150,7 +150,7 @@ public class ImgUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void createImageTest() throws IORuntimeException, IOException {
|
||||
ImgUtil.createImage(
|
||||
"版权所有",
|
||||
@@ -162,7 +162,7 @@ public class ImgUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void createTransparentImageTest() throws IORuntimeException, IOException {
|
||||
ImgUtil.createTransparentImage(
|
||||
"版权所有",
|
||||
@@ -173,7 +173,7 @@ public class ImgUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void issue2765Test() {
|
||||
// 利用图片元数据工具读取图片旋转角度信息
|
||||
final File file = FileUtil.file("d:/test/204691690-715c29d9-793a-4b29-ab1d-191a741438bb.jpg");
|
||||
|
Reference in New Issue
Block a user