修改单元测试中获取配置文件路径的方式

This commit is contained in:
houjinchuan
2024-01-22 17:43:06 +08:00
parent e7fc4feb6f
commit a8c3277eba

View File

@@ -83,7 +83,8 @@ public class FileChunkCombinerTests {
@Before @Before
public void testBefore() throws Exception { public void testBefore() throws Exception {
ParameterTool parameterTool = ParameterTool.fromPropertiesFile("C:\\Users\\root\\Documents\\file-chunk-combiner\\src\\main\\resources\\common.properties"); String path = FileChunkCombinerTests.class.getClassLoader().getResource("common.properties").getPath();
ParameterTool parameterTool = ParameterTool.fromPropertiesFile(path);
configuration = parameterTool.getConfiguration(); configuration = parameterTool.getConfiguration();
duplicateChunkCounter = new SimpleCounter(); duplicateChunkCounter = new SimpleCounter();
combineErrorCounter = new SimpleCounter(); combineErrorCounter = new SimpleCounter();