Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync USERNAME_REGEXP with the UI one #428

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,5 @@ public class ValidationConstants {
public static final String CATEGORY_NAME_BAD_FORMED = "{greenCity.validation.bad.formed.category.name}";
public static final int PLACE_NAME_MAX_LENGTH = 30;
public static final String USERNAME_REGEXP =
"""
^(?!.*\\.\\.)(?!.*\\.$)(?!.*\\-\\-)\
(?=[ЄІЇҐЁА-ЯA-Z])\
[ЄІЇҐЁєіїґёА-Яа-яA-Za-z0-9\\s-'’.\\"]\
{1,30}\
(?<![ЭэЁёъЪЫы])$\
""";
"^[ґҐіІєЄїЇА-Яа-яa-zA-Z](?!.*\\.$)(?!.*?\\.\\.)(?!.*?--)(?!.*?'')[-'ʼ’ ґҐіІєЄїЇА-Яа-я\\w.]{0,29}$";
LazarenkoDmytro marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,60 @@ private static Stream<Arguments> provideFieldsAndValidValues() {
Arguments.of("T'’.t"),
Arguments.of("T2"),
Arguments.of("ІіЇїҐґЄє"),
Arguments.of("ІіЇїҐґ Єє"),
Arguments.of("Імʼя"),
Arguments.of("Тест"),
Arguments.of("Test"));
Arguments.of("Тест123"),
Arguments.of("Ґ.Ї.Є"),
Arguments.of("Тест-Тест"),
Arguments.of("ІмʼяʼТест"),
Arguments.of("АртемʼЄвгенович"),
Arguments.of("Test"),
Arguments.of("Test.Name"),
Arguments.of("Test-Name"),
Arguments.of("Name'Last"),
Arguments.of("Name2"),
Arguments.of("Імʼя.Тест"),
Arguments.of("ҐрімʼТест"),
Arguments.of("ЄвгенҐ123"),
Arguments.of("Ім'я-Тест"),
Arguments.of("Test-Test"),
Arguments.of("User123"),
Arguments.of("Імʼя2Тест"),
Arguments.of("ТестʼІмʼя"),
Arguments.of("Євген.Тест"));
}

private static Stream<Arguments> provideFieldsAndInvalidValues() {
return Stream.of(
Arguments.of("."),
Arguments.of(".."),
Arguments.of("-"),
Arguments.of("'"),
Arguments.of("ʼ"),
Arguments.of("ʼʼ"),
Arguments.of("--"),
Arguments.of("..Тест"),
Arguments.of("Тест.."),
Arguments.of("Тест..Імʼя"),
Arguments.of("Тест--Імʼя"),
Arguments.of("Тест.."),
Arguments.of("Тест..Тест"),
Arguments.of("Тест--Тест"),
Arguments.of("Тест@Імʼя"),
Arguments.of("Імʼя#Тест"),
Arguments.of("Імʼя_Тест!"),
Arguments.of("ІмʼяТестЗанадтоДовгеБільше30Символів"),
Arguments.of("12345"),
Arguments.of(" Імʼя"),
Arguments.of(".."),
Arguments.of("1234567890123456789012345678901"),
Arguments.of(""),
Arguments.of(" "),
Arguments.of("t"),
Arguments.of("1"),
Arguments.of("T."),
Arguments.of("T.."),
Arguments.of("T--"),
Arguments.of("ЭэЁёЪъЫы"),
Arguments.of("@#$"),
Arguments.of("T."),
Arguments.of("1test"),
Arguments.of("test"),
Arguments.of("@#$"),
Arguments.of("Testttttttttttttttttttttttttttt"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,60 @@ private static Stream<Arguments> provideFieldsAndValidValues() {
Arguments.of("T'’.t"),
Arguments.of("T2"),
Arguments.of("ІіЇїҐґЄє"),
Arguments.of("ІіЇїҐґ Єє"),
Arguments.of("Імʼя"),
Arguments.of("Тест"),
Arguments.of("Test"));
Arguments.of("Тест123"),
Arguments.of("Ґ.Ї.Є"),
Arguments.of("Тест-Тест"),
Arguments.of("ІмʼяʼТест"),
Arguments.of("АртемʼЄвгенович"),
Arguments.of("Test"),
Arguments.of("Test.Name"),
Arguments.of("Test-Name"),
Arguments.of("Name'Last"),
Arguments.of("Name2"),
Arguments.of("Імʼя.Тест"),
Arguments.of("ҐрімʼТест"),
Arguments.of("ЄвгенҐ123"),
Arguments.of("Ім'я-Тест"),
Arguments.of("Test-Test"),
Arguments.of("User123"),
Arguments.of("Імʼя2Тест"),
Arguments.of("ТестʼІмʼя"),
Arguments.of("Євген.Тест"));
}

private static Stream<Arguments> provideFieldsAndInvalidValues() {
return Stream.of(
Arguments.of("."),
Arguments.of(".."),
Arguments.of("-"),
Arguments.of("'"),
Arguments.of("ʼ"),
Arguments.of("ʼʼ"),
Arguments.of("--"),
Arguments.of("..Тест"),
Arguments.of("Тест.."),
Arguments.of("Тест..Імʼя"),
Arguments.of("Тест--Імʼя"),
Arguments.of("Тест.."),
Arguments.of("Тест..Тест"),
Arguments.of("Тест--Тест"),
Arguments.of("Тест@Імʼя"),
Arguments.of("Імʼя#Тест"),
Arguments.of("Імʼя_Тест!"),
Arguments.of("ІмʼяТестЗанадтоДовгеБільше30Символів"),
Arguments.of("12345"),
Arguments.of(" Імʼя"),
Arguments.of(".."),
Arguments.of("1234567890123456789012345678901"),
Arguments.of(""),
Arguments.of(" "),
Arguments.of("t"),
Arguments.of("1"),
Arguments.of("T."),
Arguments.of("T.."),
Arguments.of("T--"),
Arguments.of("ЭэЁёЪъЫы"),
Arguments.of("@#$"),
Arguments.of("T."),
Arguments.of("1test"),
Arguments.of("test"),
Arguments.of("@#$"),
Arguments.of("Testttttttttttttttttttttttttttt"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,60 @@ private static Stream<Arguments> provideFieldsAndValidValues() {
Arguments.of("T'’.t"),
Arguments.of("T2"),
Arguments.of("ІіЇїҐґЄє"),
Arguments.of("ІіЇїҐґ Єє"),
Arguments.of("Імʼя"),
Arguments.of("Тест"),
Arguments.of("Test"));
Arguments.of("Тест123"),
Arguments.of("Ґ.Ї.Є"),
Arguments.of("Тест-Тест"),
Arguments.of("ІмʼяʼТест"),
Arguments.of("АртемʼЄвгенович"),
Arguments.of("Test"),
Arguments.of("Test.Name"),
Arguments.of("Test-Name"),
Arguments.of("Name'Last"),
Arguments.of("Name2"),
Arguments.of("Імʼя.Тест"),
Arguments.of("ҐрімʼТест"),
Arguments.of("ЄвгенҐ123"),
Arguments.of("Ім'я-Тест"),
Arguments.of("Test-Test"),
Arguments.of("User123"),
Arguments.of("Імʼя2Тест"),
Arguments.of("ТестʼІмʼя"),
Arguments.of("Євген.Тест"));
}

private static Stream<Arguments> provideFieldsAndInvalidValues() {
return Stream.of(
Arguments.of("."),
Arguments.of(".."),
Arguments.of("-"),
Arguments.of("'"),
Arguments.of("ʼ"),
Arguments.of("ʼʼ"),
Arguments.of("--"),
Arguments.of("..Тест"),
Arguments.of("Тест.."),
Arguments.of("Тест..Імʼя"),
Arguments.of("Тест--Імʼя"),
Arguments.of("Тест.."),
Arguments.of("Тест..Тест"),
Arguments.of("Тест--Тест"),
Arguments.of("Тест@Імʼя"),
Arguments.of("Імʼя#Тест"),
Arguments.of("Імʼя_Тест!"),
Arguments.of("ІмʼяТестЗанадтоДовгеБільше30Символів"),
Arguments.of("12345"),
Arguments.of(" Імʼя"),
Arguments.of(".."),
Arguments.of("1234567890123456789012345678901"),
Arguments.of(""),
Arguments.of(" "),
Arguments.of("t"),
Arguments.of("1"),
Arguments.of("T."),
Arguments.of("T.."),
Arguments.of("T--"),
Arguments.of("ЭэЁёЪъЫы"),
Arguments.of("@#$"),
Arguments.of("T."),
Arguments.of("1test"),
Arguments.of("test"),
Arguments.of("@#$"),
Arguments.of("Testttttttttttttttttttttttttttt"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,60 @@ private static Stream<Arguments> provideFieldsAndValidValues() {
Arguments.of("T'’.t"),
Arguments.of("T2"),
Arguments.of("ІіЇїҐґЄє"),
Arguments.of("ІіЇїҐґ Єє"),
Arguments.of("Імʼя"),
Arguments.of("Тест"),
Arguments.of("Test"));
Arguments.of("Тест123"),
Arguments.of("Ґ.Ї.Є"),
Arguments.of("Тест-Тест"),
Arguments.of("ІмʼяʼТест"),
Arguments.of("АртемʼЄвгенович"),
Arguments.of("Test"),
Arguments.of("Test.Name"),
Arguments.of("Test-Name"),
Arguments.of("Name'Last"),
Arguments.of("Name2"),
Arguments.of("Імʼя.Тест"),
Arguments.of("ҐрімʼТест"),
Arguments.of("ЄвгенҐ123"),
Arguments.of("Ім'я-Тест"),
Arguments.of("Test-Test"),
Arguments.of("User123"),
Arguments.of("Імʼя2Тест"),
Arguments.of("ТестʼІмʼя"),
Arguments.of("Євген.Тест"));
}

private static Stream<Arguments> provideFieldsAndInvalidValues() {
return Stream.of(
Arguments.of("."),
Arguments.of(".."),
Arguments.of("-"),
Arguments.of("'"),
Arguments.of("ʼ"),
Arguments.of("ʼʼ"),
Arguments.of("--"),
Arguments.of("..Тест"),
Arguments.of("Тест.."),
Arguments.of("Тест..Імʼя"),
Arguments.of("Тест--Імʼя"),
Arguments.of("Тест.."),
Arguments.of("Тест..Тест"),
Arguments.of("Тест--Тест"),
Arguments.of("Тест@Імʼя"),
Arguments.of("Імʼя#Тест"),
Arguments.of("Імʼя_Тест!"),
Arguments.of("ІмʼяТестЗанадтоДовгеБільше30Символів"),
Arguments.of("12345"),
Arguments.of(" Імʼя"),
Arguments.of(".."),
Arguments.of("1234567890123456789012345678901"),
Arguments.of(""),
Arguments.of(" "),
Arguments.of("t"),
Arguments.of("1"),
Arguments.of("T."),
Arguments.of("T.."),
Arguments.of("T--"),
Arguments.of("ЭэЁёЪъЫы"),
Arguments.of("@#$"),
Arguments.of("T."),
Arguments.of("1test"),
Arguments.of("test"),
Arguments.of("@#$"),
Arguments.of("Testttttttttttttttttttttttttttt"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,60 @@ private static Stream<Arguments> provideFieldsAndValidValues() {
Arguments.of("T'’.t"),
Arguments.of("T2"),
Arguments.of("ІіЇїҐґЄє"),
Arguments.of("ІіЇїҐґ Єє"),
Arguments.of("Імʼя"),
Arguments.of("Тест"),
Arguments.of("Test"));
Arguments.of("Тест123"),
Arguments.of("Ґ.Ї.Є"),
Arguments.of("Тест-Тест"),
Arguments.of("ІмʼяʼТест"),
Arguments.of("АртемʼЄвгенович"),
Arguments.of("Test"),
Arguments.of("Test.Name"),
Arguments.of("Test-Name"),
Arguments.of("Name'Last"),
Arguments.of("Name2"),
Arguments.of("Імʼя.Тест"),
Arguments.of("ҐрімʼТест"),
Arguments.of("ЄвгенҐ123"),
Arguments.of("Ім'я-Тест"),
Arguments.of("Test-Test"),
Arguments.of("User123"),
Arguments.of("Імʼя2Тест"),
Arguments.of("ТестʼІмʼя"),
Arguments.of("Євген.Тест"));
}

private static Stream<Arguments> provideFieldsAndInvalidValues() {
return Stream.of(
Arguments.of("."),
Arguments.of(".."),
Arguments.of("-"),
Arguments.of("'"),
Arguments.of("ʼ"),
Arguments.of("ʼʼ"),
Arguments.of("--"),
Arguments.of("..Тест"),
Arguments.of("Тест.."),
Arguments.of("Тест..Імʼя"),
Arguments.of("Тест--Імʼя"),
Arguments.of("Тест.."),
Arguments.of("Тест..Тест"),
Arguments.of("Тест--Тест"),
Arguments.of("Тест@Імʼя"),
Arguments.of("Імʼя#Тест"),
Arguments.of("Імʼя_Тест!"),
Arguments.of("ІмʼяТестЗанадтоДовгеБільше30Символів"),
Arguments.of("12345"),
Arguments.of(" Імʼя"),
Arguments.of(".."),
Arguments.of("1234567890123456789012345678901"),
Arguments.of(""),
Arguments.of(" "),
Arguments.of("t"),
Arguments.of("1"),
Arguments.of("T."),
Arguments.of("T.."),
Arguments.of("T--"),
Arguments.of("ЭэЁёЪъЫы"),
Arguments.of("@#$"),
Arguments.of("T."),
Arguments.of("1test"),
Arguments.of("test"),
Arguments.of("@#$"),
Arguments.of("Testttttttttttttttttttttttttttt"));
}
}
Loading
Loading