Skip to content
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

Add Matcher Support for Headers #72

Merged
merged 2 commits into from
Jun 22, 2022

Conversation

driverpt
Copy link
Contributor

Attempt at implementing #1

throw new AssertionError("Missing header " + headerMatcher.getKey());
}

headerMatcher.getValue()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a bit messy. Can someone take a look at this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

have you run into some concurrent issues that we need a ConcurrentHashMap and a lock object?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not at the moment. But I suspect we'll run into some issues when using JUnit's 5 Parallelized Tests.

I can remove it if you think it's best.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, please. if we face these issue we'll have to find out some other solutions how to handle concurrency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, i was on vacation. Just updated

Copy link
Collaborator

Choose a reason for hiding this comment

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

no worries 👍

Copy link
Collaborator

@musketyr musketyr left a comment

Choose a reason for hiding this comment

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

I like the idea but handling the concurrency seems like an overkill

ResponseDefinitionBuilder headers(Map<String, String> additionalHeaders);
default ResponseDefinitionBuilder headers(Map<String, String> additionalHeaders) {
additionalHeaders
.forEach((k, v) -> header(k, Matchers.equalToIgnoringCase(v)));
Copy link
Collaborator

Choose a reason for hiding this comment

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

it seems to me too relaxed to ignore the case for the value by default. I would stick with equalTo letting the developers choose themselves if they want to ignore the case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@driverpt driverpt requested a review from musketyr June 22, 2022 11:47
Copy link
Collaborator

@musketyr musketyr left a comment

Choose a reason for hiding this comment

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

good job! thanks!

@musketyr musketyr merged commit 1b70bef into agorapulse:master Jun 22, 2022
@driverpt driverpt deleted the header-matchers branch June 22, 2022 12:06
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