0

我有一个包含多个 Maven 子项目的项目。使用 Spring、JPA、JUnit。

+common
   + WebserviceBindingProvider.java  
+views
   +......
   +src/main/test/TestClass.java
   +src/main/test/resources/mocking.properties

The "common" project has a class that reads the properties file "mocking.properties" that is in the "views" project test folders - src/main/test/resources/
The common.jar is added as dependency to the views project.

The code is something like below.

Resource resource = new ClassPathResource("/mock_endpoints.properties"); 
props = PropertiesLoaderUtils.loadProperties(resource);

当我运行测试用例时,我将“道具”设为空。

谁能让我知道我错过了什么。

4

1 回答 1

1

TestClass.java应该在src/test/java/,你mocking.properties应该在src/test/resources/

于 2012-10-25T14:03:33.177 回答