如何使用扫描程序和异常在java中进行Junit测试

时间:2016-11-09 12:10:48

标签: java junit

我尝试对我的方法进行JUNIT测试,但我无法得到任何结果。

public int withDrowMoney() {
    enterAmount = scann.nextInt();

    if (enterAmount <= 10) {
        throw new IllegalArgumentException("Your enterAmount is too low");

    } else if (enterAmount >= 10000) {
        throw new IllegalArgumentException("Your enterAmount is too high");

    } else if (enterAmount % 100 != 0) {
        throw new IllegalArgumentException("You must take 100 200 and so on");

    } else if (inMemoryAtm.getAllLastWithDrow().isEmpty()) {
        NEWBALANCE = account.getAccountBalance() - enterAmount;
        inMemoryAccount.saveNewBalance(NEWBALANCE);
    } else {
        NEWBALANCE = inMemoryAccount.getSaveNewBalance().get(0) - enterAmount;
        inMemoryAccount.saveNewBalance(NEWBALANCE);

    }
    inMemoryAtm.saveLastWithDrow(enterAmount);
    return NEWBALANCE;

}

0 个答案:

没有答案