1

I'm creating a rule to check if two methods get invoked. It will get non-compliant if sendRedirect() method gets invoked after the getParameter() method.

String location = req.getParameter("url");
resp.sendRedirect(location);

Thanks.

  • Is it possible for you use smth like `Mockito`? – Oleg Cherednik Dec 18 '19 at 06:43
  • @oleg.cherednik with mockito you can check whether something has been called, and how many times, but I doubt you can check the exact order in which something was called. – Stultuske Dec 18 '19 at 06:46
  • https://stackoverflow.com/questions/21901368/mockito-verify-order-sequence-of-method-calls – Oleg Cherednik Dec 18 '19 at 06:47
  • @oleg.cherednik yes, it can check for the order, but the exact order. I might be wrong in understanding the question, but does it also test whether or not there was an(y) other call in between them? – Stultuske Dec 18 '19 at 08:05
  • I think it would be better, if the rule tests if the parameter of `Request#sendRedirect()` is from `Response#getParameter()` without any other methods(that change it between the calls) – dan1st Dec 18 '19 at 09:41

0 Answers0