Closed shuang-yang closed 6 years ago
Open a console and run the command gradlew processResources (Mac/Linux: ./gradlew processResources). It should finish with the BUILD SUCCESSFUL message. This will generate all resources required by the application and tests.
Did you run processResources
as mentioned in the setting up instructions in Developer Guide
?
May I know why getResource() is used here when "/docs" is not under the "src/main/resource" directory?
@Zhiyuan-Amos what's the answer this this question?
Hi @Zhiyuan-Amos seems this is indeed the problem. @damithc I think the problem is that I did not run the processResources command successfully because the command will generate the /docs directory under “src/main/resources".
Thanks for the help!!
Closing because this seems to be resolved. Please reopen if still not resolved.
In executing the following code (in HelpWindow.java):
String userGuideUrl = getClass().getResource(USERGUIDE_FILE_PATH).toString();
getResource(USERGUIDE_FILE_PATH) always returns null, which leads to a NullPointerExeption and thus failure of the HelpWindowTest.USERGUIDE_FILE_PATH is declared as as follows:
public static final String USERGUIDE_FILE_PATH = "/docs/UserGuide.html";
It seems the problem is that "/docs" directory is not under "/src/main/resources" directory, because when I copied the UserGuide file to "/src/main/resources" directory and removed "/docs" from the file path, the code compiles and the test is passed.
May I know why getResource() is used here when "/docs" is not under the "src/main/resource" directory? Or am I missing something here?