Skip to content

KNOX-3077 - Add unit test for pac4j.cookie.max.age param#993

Merged
moresandeep merged 4 commits intomasterfrom
KNOX-3077-2
Feb 25, 2025
Merged

KNOX-3077 - Add unit test for pac4j.cookie.max.age param#993
moresandeep merged 4 commits intomasterfrom
KNOX-3077-2

Conversation

@moresandeep
Copy link
Contributor

What changes were proposed in this pull request?

This PR adds a unit test for pac4j.cookie.max.age param

How was this patch tested?

Patch was tested locally.

@moresandeep moresandeep self-assigned this Feb 24, 2025
Comment on lines +135 to +139
List<String> params = new ArrayList<>();
params.add(Pac4jDispatcherFilter.PAC4J_CALLBACK_URL);
params.add("clientName");
params.add(SAML_KEYSTORE_PATH);
params.add(SAML_IDENTITY_PROVIDER_METADATA_PATH);
Copy link
Contributor

Choose a reason for hiding this comment

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

params are the same -> you could move it into setupCommonExpectations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, but then that does not make the tests easy to read, it is like database normalization, yes we will achieve less lines of code but at the cost of readability and we won't get any performance out of it either since this will be anyways run by JUnit framework for each tests. This was my argument against restructuring the test code in the first review, i like to see all the expectations and mock objects in the function so that they are easy to read and update in the future. Consider when we have to update the tests now it is not as easy to modify these multiple functions that could affect other tests. Also, creating new test cases might be a bit more work as we have to go though all the functions to understand what it does. Basically, my point is keeping all the code in one function is simpler to read and extend, there is no performance impact other than taking up some extra space on github, also the ROI for these changes is really low :)
my 2 cents :)

Copy link
Contributor

@smolnar82 smolnar82 left a comment

Choose a reason for hiding this comment

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

LGTM :)
Thanks for addressing my comment so quickly.

@moresandeep
Copy link
Contributor Author

LGTM :) Thanks for addressing my comment so quickly.

Awesome! thank you for the detailed comments, as always greatly appreciate your feedback !!

@moresandeep moresandeep merged commit 098140d into master Feb 25, 2025
4 checks passed
@moresandeep moresandeep deleted the KNOX-3077-2 branch February 25, 2025 19:12
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