0

我尝试使用 DI (PicoContainer) 使我的测试更简单,但现在它不再正常工作了。

我得到这个错误消息:


java.lang.NullPointerException

在 org.javalite.activejdbc.Model.setRaw(Model.java:355)

在 org.javalite.activejdbc.Model.setInteger(Model.java:1740)

在 cash_withdrawal.Account.(Account.java:11)

在 support.TestAccount.(TestAccount.java:7)

……


支持.TestAccount:

   public class TestAccount extends Account {
    public TestAccount() {
        super(1234);
        saveIt();
        }
    }

cash_withdrawal.Account

 public class Account extends Model {
    private TransactionQueue queue = new TransactionQueue();

    public Account() {}

    public Account(int number){
        setInteger("number", number);
        setString("balance", "0.00");
    }
}

我的步骤定义:

public class AccountSteps {
TestAccount account;

public AccountSteps(TestAccount account) {
    this.account = account;
}

@Given("^my account has been credited with (\\$\\d+\\.\\d+)$")
public void myAccountHasBeenCreditedWith$(
        @Transform(MoneyConverter.class) Money amount)
        throws Throwable {
    account.credit(amount);
}
4

0 回答 0