java.lang.NoSuchMethodError: org.junit.runner.notification.RunNotifier.testAborted(Lorg/junit/ runner/Description;Ljava/lang/Throwable;) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java: 155)
And a written test test for the controller, for example, new scripts for Spring controller classes:
TestXController.java
@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={"file:D:/ABC/src/main/webapp/WEB-INF/ xyz-servlet.xml", "file:D:/ABC/src/main/webapp/WEB-INF/xyzrest-servlet.xml"}) public class TestXController { @Inject private ApplicationContext applicationContext; private MockHttpServletRequest request; private MockHttpServletResponse response; private HandlerAdapter handlerAdapter; private XController controller; @Test public void setUp() { request = new MockHttpServletRequest(); response = new MockHttpServletResponse(); handlerAdapter = applicationContext.getBean(HandlerAdapter.class);
Can someone help me on this to write test cases for Spring Controller classes, or any links to sample code.
Thanks and respect, Vienna Gopala Reddy.
source share