generated from mate-academy/jv-homework-template
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
35 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package core.basesyntax; | ||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
User user = new User("hello", null, null); | ||
|
||
UserService userService = new UserService(); | ||
userService.registerUser(user); | ||
} | ||
} |
6 changes: 5 additions & 1 deletion
6
src/main/java/core/basesyntax/PasswordValidationException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
package core.basesyntax; | ||
|
||
//write your code here | ||
public class PasswordValidationException extends Exception { | ||
public PasswordValidationException(String message) { | ||
super(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
package core.basesyntax; | ||
|
||
public class PasswordValidator { | ||
public void validate(String password, String repeatPassword) { | ||
//write your code here | ||
public void validate(String password, String repeatPassword) | ||
throws PasswordValidationException { | ||
|
||
if (password == null && repeatPassword == null | ||
|| password.length() < 10 && repeatPassword.length() < 10 | ||
|| !(password.equals(repeatPassword))) { | ||
throw new PasswordValidationException("Wrong passwords"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters