Bug 321

Summary: Empty string for Dish object allowed
Product: Group20 Reporter: awkakavou2-c
Component: DishAssignee: Anders <agmller2-c>
Status: RESOLVED FIXED    
Severity: minor CC: agmller2-c
Priority: Low    
Version: unspecified   
Hardware: PC   
OS: Windows   

Description awkakavou2-c 2019-12-01 03:20:01 HKT
Hi, i noticed that it is possible to add a dish with an empty name, I don't think this should be allowed, an exception should be created.
public Dish(String s, double d, int i){
	this.name = s;
Comment 1 Anders 2019-12-08 17:20:47 HKT
Hi, I have added an if-else statement to check if the string (dish name) has a length less than one. If that is the case then an error will be thrown. See code below:

if(s.length() < 1)
	throw new IllegalArgumentException("Empty name");
else
	this.name = s;

I mark this bug as fixed.