Skip to content

Commit 66bfe98

Browse files
nomemoryCiobanu, Andrei-Nicolin (UK - EDC)
authored andcommitted
Refactoring.
1 parent b587ae7 commit 66bfe98

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/net/andreinc/mockneat/unit/user/Passwords.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import java.util.List;
2727
import java.util.function.Supplier;
2828

29+
import static java.lang.Character.toUpperCase;
30+
import static java.util.Arrays.asList;
2931
import static net.andreinc.mockneat.alphabets.Alphabets.*;
3032
import static net.andreinc.mockneat.types.enums.DictType.*;
3133
import static net.andreinc.mockneat.types.enums.PassStrengthType.*;
@@ -107,7 +109,7 @@ private String nextMediumPassword() {
107109
// Create a objs uppercase character
108110
int randUpperCaseIdx = mockNeat.ints().range(0, noun.length() - 1).val();
109111
char replChar = resultBuff.charAt(randUpperCaseIdx);
110-
resultBuff.setCharAt(randUpperCaseIdx, Character.toUpperCase(replChar));
112+
resultBuff.setCharAt(randUpperCaseIdx, toUpperCase(replChar));
111113

112114
// Insert / Replace with a objs special character
113115
int randSpecialChrIdx = mockNeat.ints().range(0, resultBuff.length()).val();
@@ -129,8 +131,9 @@ private String nextStrongPassword() {
129131
int passLength = mockNeat.ints().range(minLength, maxLength).val();
130132
StringBuilder buff = new StringBuilder();
131133
List<Character> cAlph;
134+
List<List<Character>> lists = asList(new List[]{SPECIAL_CHARACTERS, DIGITS, LETTERS});
132135
while (passLength-- > 1) {
133-
cAlph = mockNeat.from(new List[]{SPECIAL_CHARACTERS, DIGITS, LETTERS}).val();
136+
cAlph = mockNeat.from(lists).val();
134137
buff.append(mockNeat.from(cAlph).val());
135138
}
136139
// Insert a special character to be 100% confident it exists

0 commit comments

Comments
 (0)