I am trying to get my feet wet with TDD. I am trying to write unit test cases for controllers using Mockito in conjunction with MockMvc and Junit.
But I am getting a
I had a similar issue few of my Junit tests were not working (in intellij idea) and I was also getting java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.... for those unit tests. When I try to compile the complete project using gradle from the directory through command prompt by using the command gradle clean build then the code was being compiled successfully. Whereas problem was with the Junit tests in Intellij idea they were showing the above mentioned error. I simply changed my gradle version from 3.4.1 to 2.1.3. I do not know why now my Junit tests are compiling as well as my code is being compiled through intellij as well as through command prompt. The same problem occured with another colleague of mine and he too changed the gradle version from 4 to some version of 2. The problem was resolved.