mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix test file
This commit is contained in:
parent
51cd14a0ec
commit
23f2f210f3
@ -26,7 +26,7 @@ import java.util.ArrayList;
|
|||||||
public class LineReaderTest {
|
public class LineReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void readLfTest() {
|
public void readLfTest() {
|
||||||
final LineReader lineReader = new LineReader(ResourceUtil.getUtf8Reader("multi_line.properties"));
|
final LineReader lineReader = new LineReader(ResourceUtil.getUtf8Reader("multi_line.txt"));
|
||||||
final ArrayList<String> list = ListUtil.of(lineReader);
|
final ArrayList<String> list = ListUtil.of(lineReader);
|
||||||
Assertions.assertEquals(3, list.size());
|
Assertions.assertEquals(3, list.size());
|
||||||
Assertions.assertEquals("test1", list.get(0));
|
Assertions.assertEquals("test1", list.get(0));
|
||||||
@ -36,7 +36,7 @@ public class LineReaderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readCrLfTest() {
|
public void readCrLfTest() {
|
||||||
final LineReader lineReader = new LineReader(ResourceUtil.getUtf8Reader("multi_line_crlf.properties"));
|
final LineReader lineReader = new LineReader(ResourceUtil.getUtf8Reader("multi_line_crlf.txt"));
|
||||||
final ArrayList<String> list = ListUtil.of(lineReader);
|
final ArrayList<String> list = ListUtil.of(lineReader);
|
||||||
Assertions.assertEquals(3, list.size());
|
Assertions.assertEquals(3, list.size());
|
||||||
Assertions.assertEquals("test1", list.get(0));
|
Assertions.assertEquals("test1", list.get(0));
|
||||||
|
@ -39,14 +39,14 @@ public class FileReaderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readLinesTest() {
|
public void readLinesTest() {
|
||||||
final FileReader fileReader = FileReader.of(FileUtil.file("test.properties"));
|
final FileReader fileReader = FileReader.of(FileUtil.file("file_reader_test.txt"));
|
||||||
final List<String> strings = fileReader.readLines();
|
final List<String> strings = fileReader.readLines();
|
||||||
Assertions.assertEquals(6, strings.size());
|
Assertions.assertEquals(6, strings.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readLinesTest2() {
|
public void readLinesTest2() {
|
||||||
final FileReader fileReader = FileReader.of(FileUtil.file("test.properties"));
|
final FileReader fileReader = FileReader.of(FileUtil.file("file_reader_test.txt"));
|
||||||
final List<String> strings = fileReader.readLines(new ArrayList<>(), StrUtil::isNotBlank);
|
final List<String> strings = fileReader.readLines(new ArrayList<>(), StrUtil::isNotBlank);
|
||||||
Assertions.assertEquals(5, strings.size());
|
Assertions.assertEquals(5, strings.size());
|
||||||
}
|
}
|
||||||
|
6
hutool-core/src/test/resources/file_reader_test.txt
Normal file
6
hutool-core/src/test/resources/file_reader_test.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#--------------------------------------------
|
||||||
|
# 配置文件测试
|
||||||
|
#--------------------------------------------
|
||||||
|
|
||||||
|
a = 1
|
||||||
|
b = 2
|
@ -1,21 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2025 Hutool Team and hutool.cn
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
test1
|
|
||||||
test2=a\
|
|
||||||
bc\
|
|
||||||
d\\e
|
|
||||||
test3=abc
|
|
5
hutool-core/src/test/resources/multi_line.txt
Normal file
5
hutool-core/src/test/resources/multi_line.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
test1
|
||||||
|
test2=a\
|
||||||
|
bc\
|
||||||
|
d\\e
|
||||||
|
test3=abc
|
@ -1,21 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2025 Hutool Team and hutool.cn
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
test1
|
|
||||||
test2=a\
|
|
||||||
bc\
|
|
||||||
d\\e
|
|
||||||
test3=abc
|
|
5
hutool-core/src/test/resources/multi_line_crlf.txt
Normal file
5
hutool-core/src/test/resources/multi_line_crlf.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
test1
|
||||||
|
test2=a\
|
||||||
|
bc\
|
||||||
|
d\\e
|
||||||
|
test3=abc
|
Loading…
x
Reference in New Issue
Block a user