File tree 1 file changed +37
-0
lines changed
src/test/java/com/thealgorithms/others
1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .thealgorithms .others ;
2
+
3
+ import org .junit .jupiter .api .Test ;
4
+
5
+ import static org .junit .jupiter .api .Assertions .*;
6
+
7
+
8
+ public class PasswordGenTest {
9
+ @ Test
10
+ public void failGenerationWithSameMinMaxLengthTest () {
11
+ int length = 10 ;
12
+ assertThrows (IllegalArgumentException .class , ()-> {
13
+ PasswordGen .generatePassword (length , length );
14
+ });
15
+ }
16
+
17
+ @ Test
18
+ public void generateOneCharacterPassword () {
19
+ String tempPassword = PasswordGen .generatePassword (1 , 2 );
20
+ assertTrue (tempPassword .length ()==1 );
21
+ }
22
+
23
+ @ Test
24
+ public void failGenerationWithMinLengthSmallerThanMaxLengthTest () {
25
+ int minLength = 10 ;
26
+ int maxLength = 5 ;
27
+ assertThrows (IllegalArgumentException .class , ()-> {
28
+ PasswordGen .generatePassword (minLength , maxLength );
29
+ });
30
+ }
31
+
32
+ @ Test
33
+ public void generatePasswordNonEmptyTest () {
34
+ String tempPassword = PasswordGen .generatePassword (8 , 16 );
35
+ assertTrue (tempPassword .length ()!=0 );
36
+ }
37
+ }
You can’t perform that action at this time.
0 commit comments