From bb0e14c26f6841eab504611ac1e0a6e4024c5daf Mon Sep 17 00:00:00 2001 From: binsky Date: Thu, 17 Feb 2022 18:09:58 +0100 Subject: [PATCH] refactor PasswordGeneratorTest --- src/test/java/PasswordGeneratorTest.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/test/java/PasswordGeneratorTest.java b/src/test/java/PasswordGeneratorTest.java index 8e35b3f..8c14fe6 100644 --- a/src/test/java/PasswordGeneratorTest.java +++ b/src/test/java/PasswordGeneratorTest.java @@ -15,16 +15,17 @@ class PasswordGeneratorTest { } @Test - void generateRandomPassword() { + void testGeneratedPasswordLength() { assertNotSame("", passwordGenerator.generateRandomPassword()); assertEquals(passwordGenerator.generateRandomPassword().length(), passwordGenerator.getLength()); - // test length requirement passwordGenerator.setLength(33); assertEquals(passwordGenerator.getLength(), 33); assertEquals(passwordGenerator.generateRandomPassword().length(), passwordGenerator.getLength()); + } - // test lowercase requirement + @Test + void testPasswordLowercaseRequirement() { assertTrue(Pattern.compile("^(?=.*[a-z]).+$").matcher(passwordGenerator.generateRandomPassword()).matches()); } }