Skip to content

BAEL-6848: Set a Parameter in a HttpServletRequest in Java#14700

Merged
theangrydev merged 1 commit intoeugenp:masterfrom
manfred106:BAEL-6848-tests-fix
Sep 3, 2023
Merged

BAEL-6848: Set a Parameter in a HttpServletRequest in Java#14700
theangrydev merged 1 commit intoeugenp:masterfrom
manfred106:BAEL-6848-tests-fix

Conversation

@manfred106
Copy link
Copy Markdown
Contributor

Fix tests in BAEL-6848

firstCallValues[0] = NEW_VALUE;
String[] secondCallValues = wrapper.getParameterValues("input");
assertNotEquals(firstCallValues, secondCallValues);
assertThat(firstCallValues).isNotEqualTo(secondCallValues);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I believe @KevinGilmore might have been trying to suggest you to do something like this:

Suggested change
assertThat(firstCallValues).isNotEqualTo(secondCallValues);
assertThat(secondCallValues).doesNotContain(NEW_VALUE);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

isNotEqualTo is correct.
We are asserting whether the 2nd call of getParaemterValues() is not equal to the modified value from the 1st call.

Copy link
Copy Markdown
Collaborator

@theangrydev theangrydev Sep 3, 2023

Choose a reason for hiding this comment

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

I understand that isNotEqualTo correctly asserts that the 2nd call is not equal to the modified value from the 1st call

However, this is not really using any of the power of AssertJ to make the intention of the assertion clearer, which is what I think Kevin was trying to get you to take a look at

Logically, you are modifying with NEW_VALUE and then you want to assert that this change was not effective

By explicitly checking for NEW_VALUE being absent, the intention of the assertion is clearer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Assertion updated

firstCallValues[0] = NEW_VALUE;
String[] secondCallValues = wrapper.getParameterValues("input");
assertNotEquals(firstCallValues, secondCallValues);
assertThat(firstCallValues).isNotEqualTo(secondCallValues);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I believe @KevinGilmore might have been trying to suggest you to do something like this:

Suggested change
assertThat(firstCallValues).isNotEqualTo(secondCallValues);
assertThat(secondCallValues).doesNotContain(NEW_VALUE);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

isNotEqualTo is correct.
We are asserting whether the 2nd call of getParaemterValues() is not equal to the modified value from the 1st call.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Assertion updated

@manfred106 manfred106 force-pushed the BAEL-6848-tests-fix branch 2 times, most recently from 6aaf11d to 3405dd5 Compare September 3, 2023 09:34
@theangrydev theangrydev merged commit b077616 into eugenp:master Sep 3, 2023
@manfred106 manfred106 deleted the BAEL-6848-tests-fix branch January 11, 2026 13:43
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.

2 participants