public void testGetPostLogonMessageWhenAccountIsActiveForPurchasing(){

    String username = "robertmiller";

    String password = "java.net";

 

    class CustomerAccountMock extends CustomerAccount{

      ...

      public void loadAccountStatus() {

        this.accountStatus = "A";

      }

    }

    ICustomerAccount ca = new CustomerAccountMock(username, password);

    try {

      ca.loadAccountStatus();

    } catch (CustomerAccountsSystemOutageException e) {

      fail(""+e);

    }

    assertEquals("Your purchasing account is active.",

                              ca.getPostLogonMessage());

 }

}

  结论

  遵从上面的五个习惯将有助于开发团队开发的软件容易被团队的每一个成员阅读、理解和修改。当软件开发团队开发新的功能太快,而不考虑将来,那么他们的软件将增加高额的使用成本。不可避免的,当他们为了在一次的理解和修改软件的时候,他们将得到的是可怕的经历。如果软件很难被理解的话,增加一个新的功能会变得非常昂贵。然而,当开发团队应用这些好的经验,他们将以低的成本给业务团队提供一个新的功能。