mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add TlsSocketStrategyBuilder
This commit is contained in:
@@ -814,7 +814,7 @@ public class BeanUtilTest {
|
||||
|
||||
testPojo.setTestPojo2List(new TestPojo2[]{testPojo2, testPojo3});
|
||||
|
||||
final BeanPath beanPath = BeanPath.of("testPojo2List.age");
|
||||
final BeanPath<Object> beanPath = BeanPath.of("testPojo2List.age");
|
||||
final Object o = beanPath.getValue(testPojo);
|
||||
|
||||
assertEquals(Integer.valueOf(2), ArrayUtil.get(o, 0));
|
||||
|
@@ -27,8 +27,6 @@ import org.junit.jupiter.api.condition.EnabledForJreRange;
|
||||
import org.junit.jupiter.api.condition.JRE;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
@@ -197,28 +195,6 @@ public class FileUtilTest {
|
||||
Assertions.assertEquals(normalize, normalize2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void subPathTest() {
|
||||
final Path path = Paths.get("/aaa/bbb/ccc/ddd/eee/fff");
|
||||
|
||||
Path subPath = FileUtil.subPath(path, 5, 4);
|
||||
Assertions.assertEquals("eee", subPath.toString());
|
||||
subPath = FileUtil.subPath(path, 0, 1);
|
||||
Assertions.assertEquals("aaa", subPath.toString());
|
||||
subPath = FileUtil.subPath(path, 1, 0);
|
||||
Assertions.assertEquals("aaa", subPath.toString());
|
||||
|
||||
// 负数
|
||||
subPath = FileUtil.subPath(path, -1, 0);
|
||||
Assertions.assertEquals("aaa/bbb/ccc/ddd/eee", subPath.toString().replace('\\', '/'));
|
||||
subPath = FileUtil.subPath(path, -1, Integer.MAX_VALUE);
|
||||
Assertions.assertEquals("fff", subPath.toString());
|
||||
subPath = FileUtil.subPath(path, -1, path.getNameCount());
|
||||
Assertions.assertEquals("fff", subPath.toString());
|
||||
subPath = FileUtil.subPath(path, -2, -3);
|
||||
Assertions.assertEquals("ddd", subPath.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void subPathTest2() {
|
||||
String subPath = FileUtil.subPath("d:/aaa/bbb/", "d:/aaa/bbb/ccc/");
|
||||
@@ -243,20 +219,6 @@ public class FileUtilTest {
|
||||
Assertions.assertEquals("", subPath);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPathEle() {
|
||||
final Path path = Paths.get("/aaa/bbb/ccc/ddd/eee/fff");
|
||||
|
||||
Path ele = FileUtil.getPathEle(path, -1);
|
||||
Assertions.assertEquals("fff", ele.toString());
|
||||
ele = FileUtil.getPathEle(path, 0);
|
||||
Assertions.assertEquals("aaa", ele.toString());
|
||||
ele = FileUtil.getPathEle(path, -5);
|
||||
Assertions.assertEquals("bbb", ele.toString());
|
||||
ele = FileUtil.getPathEle(path, -6);
|
||||
Assertions.assertEquals("aaa", ele.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnabledForJreRange(max = JRE.JAVA_8)
|
||||
public void listFileNamesTest() {
|
||||
|
@@ -164,4 +164,40 @@ public class PathUtilTest {
|
||||
|
||||
assertTrue(PathUtil.isSameFile(srcFile.toPath(), destFile.toPath()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void subPathTest() {
|
||||
final Path path = Paths.get("/aaa/bbb/ccc/ddd/eee/fff");
|
||||
|
||||
Path subPath = PathUtil.subPath(path, 5, 4);
|
||||
Assertions.assertEquals("eee", subPath.toString());
|
||||
subPath = PathUtil.subPath(path, 0, 1);
|
||||
Assertions.assertEquals("aaa", subPath.toString());
|
||||
subPath = PathUtil.subPath(path, 1, 0);
|
||||
Assertions.assertEquals("aaa", subPath.toString());
|
||||
|
||||
// 负数
|
||||
subPath = PathUtil.subPath(path, -1, 0);
|
||||
Assertions.assertEquals("aaa/bbb/ccc/ddd/eee", subPath.toString().replace('\\', '/'));
|
||||
subPath = PathUtil.subPath(path, -1, Integer.MAX_VALUE);
|
||||
Assertions.assertEquals("fff", subPath.toString());
|
||||
subPath = PathUtil.subPath(path, -1, path.getNameCount());
|
||||
Assertions.assertEquals("fff", subPath.toString());
|
||||
subPath = PathUtil.subPath(path, -2, -3);
|
||||
Assertions.assertEquals("ddd", subPath.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPathEleTest() {
|
||||
final Path path = Paths.get("/aaa/bbb/ccc/ddd/eee/fff");
|
||||
|
||||
Path ele = PathUtil.getPathEle(path, -1);
|
||||
assertEquals("fff", ele.toString());
|
||||
ele = PathUtil.getPathEle(path, 0);
|
||||
assertEquals("aaa", ele.toString());
|
||||
ele = PathUtil.getPathEle(path, -5);
|
||||
assertEquals("bbb", ele.toString());
|
||||
ele = PathUtil.getPathEle(path, -6);
|
||||
assertEquals("aaa", ele.toString());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user