NetBeans 5.0 单元测试实践[2]

发表于:2010-04-26来源:作者:点击数: 标签:实践单元NetBeansNetbeans
NetBeans 5.0 单元测试 实践[2] 软件测试 package moneychange; public class Money { private int fAmount; private String fCurrency; public Money(int amount,String currency) { fAmount=amount; fCurrency=currency; } public int amount() { return f

  NetBeans 5.0 单元测试实践[2]  软件测试

  package moneychange;

  public class Money {

  private int fAmount;

  private String fCurrency;

  public Money(int amount,String currency) {

  fAmount=amount;

  fCurrency=currency;

  }

  public int amount()

  {

  return fAmount;

  }

  public String currency()

  {

  return fCurrency;

  }

  public Money add(Money m)

  {

  return new Money(amount()+m.amount(),currency());

  }

  public boolean equals(Object anObject)

  {

  if(anObject instanceof Money)

  {

  Money aMoney=(Money)anObject;

  return aMoney.currency().equals(currency())

原文转自:http://www.ltesting.net