This commit is contained in:
Looly
2023-04-12 00:52:11 +08:00
parent 2554fbb896
commit ea9349949b
12 changed files with 295 additions and 271 deletions

View File

@@ -1,5 +1,6 @@
package org.dromara.hutool.core.lang;
import org.dromara.hutool.core.lang.tuple.Tuple;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

View File

@@ -1,7 +1,7 @@
package org.dromara.hutool.core.lang.func;
import org.dromara.hutool.core.func.*;
import org.dromara.hutool.core.lang.Tuple;
import org.dromara.hutool.core.lang.tuple.Tuple;
import org.dromara.hutool.core.reflect.MethodUtil;
import lombok.AllArgsConstructor;
import lombok.Data;

View File

@@ -0,0 +1,45 @@
/*
* Copyright (c) 2023 looly(loolly@aliyun.com)
* Hutool is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
package org.dromara.hutool.core.lang.tuple;
import org.dromara.hutool.core.lang.mutable.MutableTriple;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* {@link Triple} 三元组单元测试
* {@link MutableTriple} 三元组单元测试
*
* @author kirno7
*/
public class TripleTest {
@Test
public void mutableTripleTest() {
final MutableTriple<String, String, String> mutableTriple = MutableTriple
.of("1", "1", "1");
Assertions.assertEquals("Triple {left=1, middle=1, right=1}", mutableTriple.toString());
mutableTriple.setLeft("2");
mutableTriple.setMiddle("2");
mutableTriple.setRight("2");
Assertions.assertEquals("Triple {left=2, middle=2, right=2}", mutableTriple.toString());
}
@Test
public void tripleTest() {
final Triple<String, String, String> triple = Triple
.of("3", "3", "3");
Assertions.assertEquals("Triple {left=3, middle=3, right=3}", triple.toString());
}
}

View File

@@ -1,23 +0,0 @@
package org.dromara.hutool.core.tuple;
import org.junit.jupiter.api.Test;
/**
* {@link ImmutableTriple} 三元组单元测试
* {@link MutableTriple} 三元组单元测试
*
* @author kirno7
*/
public class TripleTest {
@Test
public void tripleTest() {
MutableTriple<String, String, String> mutableTriple = MutableTriple.of("1", "1", "1");
System.out.println(mutableTriple);
mutableTriple.setLeft("2");
mutableTriple.setMiddle("2");
mutableTriple.setRight("2");
System.out.println(mutableTriple);
ImmutableTriple<String, String, String> immutableTriple = ImmutableTriple.of("3", "3", "3");
System.out.println(immutableTriple);
}
}