diff --git a/src/main/java/de/hs_mannheim/domain/System.java b/src/main/java/de/hs_mannheim/domain/System.java index 02f4dd0..476a481 100644 --- a/src/main/java/de/hs_mannheim/domain/System.java +++ b/src/main/java/de/hs_mannheim/domain/System.java @@ -111,7 +111,7 @@ public class System { return false; } - public boolean sign_up_user(String username, String password, String hometown, String zip, + public boolean sign_up_user(String username, String password, String password_authentication, String hometown, String zip, String car_name, String car_l_100kmS, String car_avg_kmhS, String bike_avg_kmhS){ double car_l_100km; @@ -129,6 +129,9 @@ public class System { if(username.equals("")||password.equals("")||hometown.equals("")||zip.equals("")) return false; + if(!password.equals(password_authentication)) + return false; + for(User user: this.all_user) if(user.getUsername().equals(username)) return false; diff --git a/src/main/java/de/hs_mannheim/facade/Application.java b/src/main/java/de/hs_mannheim/facade/Application.java index 015597b..d771bde 100644 --- a/src/main/java/de/hs_mannheim/facade/Application.java +++ b/src/main/java/de/hs_mannheim/facade/Application.java @@ -16,9 +16,9 @@ public class Application { return running_system.sign_in_user(username, password); } - public boolean sign_up_user(String username, String password, String hometown, String zip, + public boolean sign_up_user(String username, String password, String password_authentication, String hometown, String zip, String car_name, String car_co2_km, String car_avg_kmh, String bike_avg_kmh){ - return running_system.sign_up_user(username, password, hometown, zip, car_name, car_co2_km, car_avg_kmh, bike_avg_kmh); + return running_system.sign_up_user(username, password, password_authentication, hometown, zip, car_name, car_co2_km, car_avg_kmh, bike_avg_kmh); } public void sign_out_user(){ diff --git a/src/test/java/de/hs_mannheim/domain/SystemTest.java b/src/test/java/de/hs_mannheim/domain/SystemTest.java index 24344b0..31fe19a 100644 --- a/src/test/java/de/hs_mannheim/domain/SystemTest.java +++ b/src/test/java/de/hs_mannheim/domain/SystemTest.java @@ -123,11 +123,11 @@ public class SystemTest { @Test public void sign_up_user(){ // Username darf nicht doppelt vorkommen! - assertEquals(false, current_system.sign_up_user("David","123Esel","Mannheim","68161","AMG","10","300","20")); - assertEquals(true, current_system.sign_up_user("Selim","Penis69","Mannheim","68161","AMG","10","300","20")); + assertEquals(false, current_system.sign_up_user("David","123Esel","123Esel","Mannheim","68161","AMG","10","300","20")); + assertEquals(true, current_system.sign_up_user("Selim","Penis69","Penis69","Mannheim","68161","AMG","10","300","20")); // PLZ muss mit Stadt übereinstimmen - assertEquals(false, current_system.sign_up_user("Lukas","123Esel","Mannheim","11105","AMG","10","300","20")); - assertEquals(true, current_system.sign_up_user("Lukas","123Esel","Mannheim","68305","AMG","10","300","20")); + assertEquals(false, current_system.sign_up_user("Lukas","123Esel","123Esel","Mannheim","11105","AMG","10","300","20")); + assertEquals(true, current_system.sign_up_user("Lukas","123Esel","123Esel","Mannheim","68305","AMG","10","300","20")); assertEquals("Lukas",current_system.getDetails()[0]); current_system.sign_out_user();