Summarizing the Test


Let's summarize what the test is supposed to be doing, line by line:

Student student = new Student ("Jane Doe");

Create a student whose name is Jane Doe. Store it locally.

String studentName = student .getName();

Ask for the name of the student and store it in a local variable.

assertEquals("Jane Doe", studentName);

Make sure that the name of the student returned was Jane Doe.


That's a lot of things to know in order to understand a few short lines of code. However, you have already seen the foundation for a large part of Java programming. In welldesigned object-oriented Java coding, most statements involve either creating new objects, sending messages to other objects, or assigning object addresses (whether the objects are created via new or are returned from a message send) to an object reference.



Agile Java. Crafting Code with Test-Driven Development
Agile Javaв„ў: Crafting Code with Test-Driven Development
ISBN: 0131482394
EAN: 2147483647
Year: 2003
Pages: 391
Authors: Jeff Langr

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net