Home > Articles > Software Development & Management > Agile

  • Print
  • + Share This
From the author of

Let's Try That Again


We'll begin with nothing more than a simple test:


public class CustomerTest
extends TestCase { public void testToXML()
throws Exception { Customer c =
new Customer(); } }

This doesn't compile, so we'll write the simplest module that will make it compile:

public class Customer
{
}

This compiles, and the test runs. Now we can add more to the test:

public void testToXML() throws Exception
{
  Customer c = new Customer();
  c.name = "John Smith";
  c.address = "55 Somewhere, City, State Zip";
  c.email = "jsmith@somewhere.com";
  c.phone = "111-222-3333";
  c.fax = "444-555-6666";
  c.cellPhone = "777-888-9999";
}

Again, this doesn't compile, so we add just enough to Customer to make it compile.

public class Customer
{
  public String name;
  public String address;
  public String email;
  public String phone;
  public String fax;
  public String cellPhone;
}
  • + Share This
  • 🔖 Save To Your Account