Hoist up Node Gradle plugin, set TestTomcat baseDir, add hasContentType matcher, HTTP status consts #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a redo of #3 and #6. #4 didn't help, and I'm holding off on merging #5.
Combining several small touch up changes in one:
Hoist Node Gradle plugin up to settings.gradle.kts
settings.gradle.kts
seems a better place to specify the versions of Gradle plugins than in the project specificbuild.gradle.kts
files.Set TestTomcat baseDir explicitly
This is in preparation for possibly launching a TestTomcat per test method, instead of per test fixture/suite.
I found out that trying to dynamically create a baseDir for each instance led to the first instance's baseDir reappearing. I haven't been able to see clearly how this is happening, but it seems that:
Add hasContentType matcher, HTTP status consts
This matcher removes a lot of boilerplate from checking the Content-Type of a HttpResponse. It's based on the Hamcrest API with the help of these tutorials:
This could be generalized to handle any header. However, I want to keep it straightforward for now, as a good basic example of how to write a custom matcher.
Also took the opportunity to replace bare HTTP status codes (200, et. al.) with constants defined on jakarta.servlet.http.HttpServletResponse.