Skip to content

Commit

Permalink
refactor: fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
llorentelemmc committed Sep 2, 2024
1 parent 070d724 commit 6191b74
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public Query addFilterAndCreateQuery(StringBuilder stringQuery, List<CustomFilte
}

if (filterQuery.length() > 0) {
appendWhereIfNotAlreadyExists(stringQuery);
appendWhereOrAndStatementsToQuery(stringQuery);
stringQuery.append('(').append(filterQuery).append(')');
}
}
Expand Down Expand Up @@ -173,6 +173,13 @@ private String extractJoiningtableForFilter(List<CustomFilter> filters) {
return (uniqueJoiningString.length() == 0) ? "" : (SPACE_STRING + uniqueJoiningString);
}

private void appendWhereOrAndStatementsToQuery(StringBuilder stringQuery) {
appendWhereIfNotAlreadyExists(stringQuery);
if (stringQuery.toString().endsWith(") ")) {
stringQuery.append("and ");
}
}

private void appendWhereIfNotAlreadyExists(StringBuilder stringQuery) {
if (!stringQuery.toString().contains(WHERE)) {
stringQuery.append(WHERE + SPACE_STRING);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public void createAndSendMailForDeplyoments_oneDeployment_noAddress_sending_nok_
}

@Test
public void createAndSendMailForDeplyoments_oneDeployment_noAddress_sending_Exception() throws MessagingException {
public void createAndSendMailForDeployments_oneDeployment_noAddress_sending_Exception() throws MessagingException {
// given
ArrayList<DeploymentEntity> deployments = new ArrayList<DeploymentEntity>();

Expand All @@ -206,7 +206,7 @@ public void createAndSendMailForDeplyoments_oneDeployment_noAddress_sending_Exce


@Test
public void createAndSendMailForDeplyoments_oneDeployment_noAddress_sending_Recipients() throws MessagingException {
public void createAndSendMailForDeployments_oneDeployment_noAddress_sending_Recipients() throws MessagingException {
// given
ArrayList<DeploymentEntity> deployments = new ArrayList<DeploymentEntity>();

Expand Down

0 comments on commit 6191b74

Please sign in to comment.