-
Notifications
You must be signed in to change notification settings - Fork 65
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
EPMRPP-81970 || Autocomplete in Recipients filed on Notifications tab in Project settings should show options starting from 1 symbol #1681
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,9 @@ | |
@Service | ||
public class GetProjectHandlerImpl implements GetProjectHandler { | ||
|
||
private static final String LENGTH_LESS_THAN_1_SYMBOL_MSG = "Length of the filtering string " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
+ "'{}' is less than 1 symbol"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
private final ProjectRepository projectRepository; | ||
|
||
private final UserRepository userRepository; | ||
|
@@ -133,19 +136,19 @@ public ProjectResource getResource(String projectName, ReportPortalUser user) { | |
|
||
@Override | ||
public List<String> getUserNames(ReportPortalUser.ProjectDetails projectDetails, String value) { | ||
BusinessRule.expect(value.length() > 2, Predicates.equalTo(true)) | ||
.verify(ErrorType.INCORRECT_FILTER_PARAMETERS, | ||
Suppliers.formattedSupplier("Length of the filtering string '{}' is less than 3 symbols", value) | ||
); | ||
checkBusinessRuleLessThan1Symbol(value); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return userRepository.findNamesByProject(projectDetails.getProjectId(), value); | ||
} | ||
|
||
@Override | ||
public Iterable<SearchUserResource> getUserNames(String value, ReportPortalUser.ProjectDetails projectDetails, Pageable pageable) { | ||
private void checkBusinessRuleLessThan1Symbol(String value) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
BusinessRule.expect(value.length() >= 1, Predicates.equalTo(true)) | ||
.verify(ErrorType.INCORRECT_FILTER_PARAMETERS, | ||
Suppliers.formattedSupplier("Length of the filtering string '{}' is less than 1 symbol", value) | ||
); | ||
Suppliers.formattedSupplier(LENGTH_LESS_THAN_1_SYMBOL_MSG, value)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
@Override | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
public Iterable<SearchUserResource> getUserNames(String value, ReportPortalUser.ProjectDetails projectDetails, Pageable pageable) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
checkBusinessRuleLessThan1Symbol(value); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
final CompositeFilterCondition userCondition = getUserSearchCondition(value); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,10 +111,12 @@ void getUserNamesByIncorrectTerm() { | |
ReportPortalUser user = getRpUser("user", UserRole.USER, ProjectRole.PROJECT_MANAGER, projectId); | ||
|
||
ReportPortalException exception = assertThrows(ReportPortalException.class, | ||
() -> handler.getUserNames(extractProjectDetails(user, "test_project"), "qw") | ||
() -> handler.getUserNames(extractProjectDetails(user, "test_project"), "") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
); | ||
|
||
assertEquals("Incorrect filtering parameters. Length of the filtering string 'qw' is less than 3 symbols", exception.getMessage()); | ||
assertEquals( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
"Incorrect filtering parameters. Length of the filtering string '' is less than 1 symbol", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
exception.getMessage()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
@Test | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is longer than 100 characters (found 101).