Issue in writing Unit Test using JUnit5 for Servlet
Hi,
So I am trying to write a JUnit unit test for a servlet. I set the RequestPathInfo using the following:
Hi,
So I am trying to write a JUnit unit test for a servlet. I set the RequestPathInfo using the following:
Hi @shivani_panchal39 ,
In your code you are converting the RequestPathInfo object to a string, that's why you are seeing that behavior here
String pathInfo= String.valueOf(request.getRequestPathInfo());
Not sure what would you want to read from requestParhInfo, but you could use
requestPathInfo.setExtension("json");
requestPathInfo.setSuffix("temp");
requestPathInfo.setSelectorString("str1");
and in the Servlet, read the values from the reqPathInfo object
request.getRequestPathInfo().getExtension()
request.getRequestPathInfo().getSelectorString()
Regards,
Nitesh
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.