mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add test
This commit is contained in:
parent
0d52562180
commit
ad5296866d
@ -19,8 +19,8 @@ import java.util.concurrent.TimeUnit;
|
|||||||
* <p>
|
* <p>
|
||||||
* 使用方法如下:
|
* 使用方法如下:
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>{@code
|
||||||
* StopWatch stopWatch = new StopWatch("任务名称");
|
* StopWatch stopWatch = StopWatch.of("任务名称");
|
||||||
*
|
*
|
||||||
* // 任务1
|
* // 任务1
|
||||||
* stopWatch.start("任务一");
|
* stopWatch.start("任务一");
|
||||||
@ -35,13 +35,22 @@ import java.util.concurrent.TimeUnit;
|
|||||||
* // 打印出耗时
|
* // 打印出耗时
|
||||||
* Console.log(stopWatch.prettyPrint());
|
* Console.log(stopWatch.prettyPrint());
|
||||||
*
|
*
|
||||||
* </pre>
|
* }</pre>
|
||||||
*
|
*
|
||||||
* @author Spring Framework, Looly
|
* @author Spring Framework, Looly
|
||||||
* @since 4.6.6
|
* @since 4.6.6
|
||||||
*/
|
*/
|
||||||
public class StopWatch {
|
public class StopWatch {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建计时任务(秒表)
|
||||||
|
*
|
||||||
|
* @return StopWatch
|
||||||
|
*/
|
||||||
|
public static StopWatch of() {
|
||||||
|
return new StopWatch();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建计时任务(秒表)
|
* 创建计时任务(秒表)
|
||||||
*
|
*
|
||||||
|
@ -8,6 +8,7 @@ import java.io.Writer;
|
|||||||
* @author looly
|
* @author looly
|
||||||
* @since 5.3.3
|
* @since 5.3.3
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("NullableProblems")
|
||||||
public final class FastStringWriter extends Writer {
|
public final class FastStringWriter extends Writer {
|
||||||
|
|
||||||
private static final int DEFAULT_CAPACITY = 16;
|
private static final int DEFAULT_CAPACITY = 16;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.hutool.core.io;
|
package cn.hutool.core.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.IORuntimeException;
|
||||||
import cn.hutool.core.io.resource.ResourceUtil;
|
import cn.hutool.core.io.resource.ResourceUtil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
17
hutool-core/src/test/java/cn/hutool/core/io/FastStringWriterTest.java
Executable file
17
hutool-core/src/test/java/cn/hutool/core/io/FastStringWriterTest.java
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
package cn.hutool.core.io;
|
||||||
|
|
||||||
|
import cn.hutool.core.text.StrUtil;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class FastStringWriterTest {
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
|
@Test
|
||||||
|
public void writeTest() {
|
||||||
|
final FastStringWriter fastStringWriter = new FastStringWriter(IoUtil.DEFAULT_BUFFER_SIZE);
|
||||||
|
fastStringWriter.write(StrUtil.repeat("hutool", 2));
|
||||||
|
|
||||||
|
Assert.assertEquals("hutoolhutool", fastStringWriter.toString());
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package cn.hutool.core.io;
|
package cn.hutool.core.io;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ManifestUtil;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user