Merge remote-tracking branch 'origin/develop' into develop

pull/602/head
chen.ma 2 years ago
commit ddd8ec224c

@ -17,12 +17,28 @@
package cn.hippo4j.common.toolkit;
import cn.hippo4j.common.function.NoArgsConsumer;
import org.junit.Test;
import java.util.concurrent.atomic.AtomicBoolean;
public class ConditionUtilTest {
@Test
public void assertCondition() {
// init consumer
AtomicBoolean checkValue = new AtomicBoolean(false);
NoArgsConsumer trueConsumer = () -> checkValue.set(true);
NoArgsConsumer falseConsumer = () -> checkValue.set(false);
// test trueConsumer run
ConditionUtil.condition(true, trueConsumer, falseConsumer);
Assert.isTrue(checkValue.get());
// test falseConsumer run
ConditionUtil.condition(false, trueConsumer, falseConsumer);
Assert.isTrue(!checkValue.get());
}
}

@ -24,5 +24,13 @@ public class FileUtilTest {
@Test
public void assertReadUtf8String() {
String testText = "abcd简体繁体\uD83D\uDE04\uD83D\uDD25& *\n" +
"second line\n" +
"empty line next\n";
String testFilePath = "classpath:/test/test_utf8.txt";
String contentByFileUtil = FileUtil.readUtf8String(testFilePath);
Assert.isTrue(testText.equals(contentByFileUtil));
}
}

@ -0,0 +1,3 @@
abcd简体繁体😄🔥& *
second line
empty line next
Loading…
Cancel
Save