Bug 303

Summary: Creating user with negative balance
Product: Group20 Reporter: Anders <agmller2-c>
Component: UserAssignee: awkakavou2-c
Status: RESOLVED FIXED    
Severity: normal CC: awkakavou2-c
Priority: ---    
Version: 1.0   
Hardware: PC   
OS: Linux   

Description Anders 2019-11-05 17:49:13 HKT
In my testing I encountered, that I was able to make a user with a negative balance. The system should check if the prompted balance is less than 0. I assume a check should be made in the constructor of <b> User.java </b>.
Comment 1 awkakavou2-c 2019-11-05 17:53:53 HKT
I believe I have resolved the issue by "throwing" an exception when trying to add a user with a negative balance.

public User(String s, double d, int i) throws IllegalArgumentException {
		// not relevant
		
		if(d < 0)
			throw new IllegalArgumentException("Negative balance");
		else
			this.balance = d;
		
		// not relevant
	}
Now when trying to create user with negative balance the message "Negative balance" is returned.