Menu

Problem with Lesson 5 - failing one test

2009-01-30
2013-04-09
  • Joseph Evans

    Joseph Evans - 2009-01-30

    I follow the great tutorial and seem to understand everything. However when I run the JUnit test it fails the testPerson test. The other two pass without a problem.

    I have:

        public void testPerson() {
            Person p1 = new Person ();
            assertEquals("unknown name", p1.getName());
            assertEquals(3, p1.getMaximumBooks());
        }

    Can someone suggest why I am failing this test of the code?

    The tutorial is excellent! I am enjoying it and look forward to every lesson.

     
    • Joseph Evans

      Joseph Evans - 2009-01-31

      Resolved, I found the error in the Person method which should have been "unknown name" instead of simply "unknown".

       
    • Mark Dexter

      Mark Dexter - 2009-01-31

      Hi. What does the fail message say? Can you please paste in the entire source code for the Person class? Thanks. Mark

       
    • Joseph Evans

      Joseph Evans - 2009-01-31

      No no, the error was a typo I made. Not your material. Sorry for not being clear.

      I had typed in "unknown" when I should have entered "unknown name".

       

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.