Package account
Class AccountImplValid4JBestPractice
java.lang.Object
account.AccountImplValid4JBestPractice
- All Implemented Interfaces:
IAccount
public class AccountImplValid4JBestPractice extends java.lang.Object implements IAccount
Implements the IAccount interface Uses Valid4J to implement the
pre-conditions The post-conditions are checked by JUnit test cases
- Author:
- Horst Lichter, Jochen Ludewig Software Engineering – Grundlagen, Menschen, Prozesse, Techniken, dpunkt.verlag (c) 2023
-
Constructor Summary
Constructors Constructor Description AccountImplValid4JBestPractice(int amount, java.lang.String owner, int overdr)
-
Method Summary
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
AccountImplValid4JBestPractice
public AccountImplValid4JBestPractice(int amount, java.lang.String owner, int overdr) throws org.valid4j.errors.ContractViolation- Parameters:
amount
- initial deposited amountowner
- of the accountoverdr
- amount of the overdraft limit- Throws:
org.valid4j.errors.ContractViolation
-
-
Method Details
-
balance
public int balance() -
deposit
public void deposit(int amount) throws org.valid4j.errors.ContractViolation -
withdraw
public void withdraw(int amount) throws org.valid4j.errors.ContractViolation -
getHolder
public java.lang.String getHolder() throws org.valid4j.errors.ContractViolation -
setHolder
public void setHolder(java.lang.String newHolder) throws org.valid4j.errors.ContractViolation -
overdraft
public int overdraft() throws org.valid4j.errors.ContractViolation -
invariant
public boolean invariant()
-