Announcement Announcement Module
No announcement yet.
JUnit Interfering with returned views Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • JUnit Interfering with returned views


    I am new to Spring and started reading the "step-by-step" tutorial.
    Instead of using Ant I am compiling directly in Eclipse, and decided to run my unit tests in Eclipse as well.
    NOTE: Using Resin server integrated into Eclipse.

    Here is the problem - when I wrote my JUnit test case as per the tutorial I initially set the most basic controller to return the wrong view - "WEB-INF/jsp/mypage.jsp".

    assertEquals("WEB-INF/jsp/mypage", modelAndView.getViewName());
    I had to change that because I currently cannot move the JSP's and forgot to put in the new path into the assert statement.
    The test case ran successfully in Eclipse, but when I tried the application it kept returning a 404 not found pointing to the old, wrong path. I noticed something else. My JUnit test class was named almost the same as my controller, only with "Tests" appended to the end of the name, and it compiled into the same directory as the controller.
    After I deleted the JUnit class, the controller began returning the correct page.

    Did anyone encounter this issue before? What could be causing this?