我试图在单元测试中测量文件长度并遇到问题。什么可能使这个测试失败?
val fileName = "filetypes/b.jpg"
val root = "C:/Users/Zotov/Work/project/target/test-classes/"
val lenAbsolute = new File(root + fileName).length()
val lenResource = Thread.currentThread().getContextClassLoader
.getResource(fileName).getFile.length()
assertEquals(lenAbsolute, lenResource)
lenAbsolute 的值是文件系统报告的值