From 647f1c4abaac42ac6de6e6cbd223253ab8afaf72 Mon Sep 17 00:00:00 2001 From: YarikNarozhnyi Date: Wed, 20 Nov 2024 19:02:55 +0000 Subject: [PATCH] 4944040 --- src/main/java/core/basesyntax/PasswordValidator.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/core/basesyntax/PasswordValidator.java b/src/main/java/core/basesyntax/PasswordValidator.java index 9d920a6b..a870c0fa 100644 --- a/src/main/java/core/basesyntax/PasswordValidator.java +++ b/src/main/java/core/basesyntax/PasswordValidator.java @@ -3,12 +3,14 @@ public class PasswordValidator { public void validate(String password, String repeatPassword) throws PasswordValidationException { - if (password.length() < 10 || repeatPassword.length() < 10 - || password == null || repeatPassword == null) { - throw new PasswordValidationException("Wrong passwords"); + if (password == null || repeatPassword == null) { + throw new PasswordValidationException("Паролі не можуть бути null"); + } + if (password.length() < 10 || repeatPassword.length() < 10) { + throw new PasswordValidationException("Паролі повинні містити щонайменше 10 символів"); } if (password.equals(repeatPassword) == false) { - throw new PasswordValidationException("Wrong passwords"); + throw new PasswordValidationException("Паролі не співпадають"); } } }