Skip to content

Conversation

@airajena
Copy link
Contributor

Description

Adds comprehensive unit tests for SQLBuilder - a security utility that builds SQL WHERE clauses without SQL injection risk.

Changes

  • 18 test methods covering:
    • Valid operators (=, <, >, <=, >=, <>, LIKE)
    • Validation (null, empty, invalid column names, invalid operators)
    • WhereLogicalOperator (AND, OR)
    • Edge cases (table prefixes, underscores, dashes)

Related Issue

FINERACT-2421

Copy link
Contributor

@Aman-Mittal Aman-Mittal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, It would be recommended to add JAVADOC for this

@airajena
Copy link
Contributor Author

airajena commented Jan 3, 2026

LGTM, It would be recommended to add JAVADOC for this

Done

@Aman-Mittal
Copy link
Contributor

LGTM, It would be recommended to add JAVADOC for this

Done

please also squash your commits into 1 commit

@airajena airajena force-pushed the FINERACT-2421/add-sqlbuilder-tests branch from a12bcd3 to 1b70acd Compare January 4, 2026 11:42
@airajena
Copy link
Contributor Author

airajena commented Jan 4, 2026

LGTM, It would be recommended to add JAVADOC for this

Done

please also squash your commits into 1 commit

Done

@adamsaghy
Copy link
Contributor

Please run:
./gradlew spotlessApply spotbugsMain spotbugsTest checkstyleMain checkstyleTest

@airajena
Copy link
Contributor Author

airajena commented Jan 9, 2026

Please run: ./gradlew spotlessApply spotbugsMain spotbugsTest checkstyleMain checkstyleTest

@adamsaghy Running ./gradlew spotlessApply locally results in a SocketTimeoutException when downloading the Eclipse Groovy formatter.
The unit tests pass locally. Could you please check if the CI failures are related to this network issue and potentially re-trigger the workflows?

@adamsaghy
Copy link
Contributor

adamsaghy commented Jan 9, 2026

Please run: ./gradlew spotlessApply spotbugsMain spotbugsTest checkstyleMain checkstyleTest

@adamsaghy Running ./gradlew spotlessApply locally results in a SocketTimeoutException when downloading the Eclipse Groovy formatter. The unit tests pass locally. Could you please check if the CI failures are related to this network issue and potentially re-trigger the workflows?

Its not timeout issue at CI. Please make sure to run locally this command till it got successfully executed!

@adamsaghy
Copy link
Contributor

adamsaghy commented Jan 9, 2026

For more on this, please refer to https://docs.gradle.org/8.14.3/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
168 actionable tasks: 147 executed, 5 from cache, 16 up-to-date
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':fineract-core:spotlessJavaCheck'.
> The following files had format violations:
      src/test/java/org/apache/fineract/infrastructure/security/utils/SQLBuilderTest.java
          @@ -25,8 +25,8 @@
           /**
           ·*·Unit·tests·for·{@link·SQLBuilder}.
           ·*·<p>
          -·*·Tests·the·SQL·WHERE·clause·builder·utility·that·prevents·SQL·injection
          -·*·by·validating·column·names,·operators,·and·using·parameterized·queries.
          +·*·Tests·the·SQL·WHERE·clause·builder·utility·that·prevents·SQL·injection·by·validating·column·names,·operators,·and
          +·*·using·parameterized·queries.
           ·*·</p>
           ·*/
           class·SQLBuilderTest·{
  Run './gradlew spotlessApply spotbugsMain spotbugsTest checkstyleMain checkstyleTest' to fix these violations.

* Try:
> Run with --stacktrace option to get the stack trace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants