Menu

Lesson6 - JUnit Test

Andre
2010-11-17
2013-04-09
  • Andre

    Andre - 2010-11-17

    THANK YOU very much for these tutorials. They are VERY useful in helping me upgrade my coding skills. But while running through Lesson6 I found that my override of the toString() method didn't work. When I ran the JUnit test, as described in the video, it showed me that the PersonTest was using the Object.toString() method, rather than the overrridden toString() method. I tried saving the changes in the Person object (hoping that somehow it would compile on Save), but the error persists. Any suggestions?

     
  • Mark Dexter

    Mark Dexter - 2010-11-17

    Hi. That sounds a bit strange. You could try removing the toString() method, rebuilding the project, and then adding it back in and rebuilding. It sounds like for some reason the compiler doesn't know you have a toString() method in that class. I guess you could also try something like deleting the entire class and then creating a new Java file for the class. Or possibly just copying in the code from the PDF document. Good luck. Mark

     
  • Andre

    Andre - 2010-11-18

    Thanks Mark.
    I did something similar, and it's working now. I closed the project and reopened it, and when I looked at the Person class I saw that the overridden toString() method was missing (for some reason it didn't "register" even though I'd typed it in; might have been because I tried using the quick key to insert it). I retyped it and re-ran the JUnit test and now it works. Thanks for the feedback.

    Draykko

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.