i want to test a service method that parses an excel file
so i need help in the following:
- i want to create a test folder for the excel files under web-app, how to do that ?
- how to load the file in the unit test ?
please advise, thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I typically put files into resources and load them as
this.getClass().getResourceAsStream("my.xsl").Please pay attention. If you put your file to the same package where your test is you just have to put the local name. Otherwise you should provide absolute path starting with
/. If your application does not know to work with streams and requires files usethis.getClass().getResource("my.xsl").getFile().