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

Fix resource path URL decoding in tx validator tests and clean similar tests #7025

Conversation

stejbac
Copy link
Contributor

@stejbac stejbac commented Feb 3, 2024

Prevent tests calling MakerTxValidatorSanityCheckTests::getValidBtcMakerFeeMempoolJsonResponseString from failing when running the build from a working directory with spaces in its absolute path, due to the fact that the test resource paths returned by Class::getResource are URL encoded.

Also do some minor tidying of other tests which load resources, and replace manual MockitoSession setup & tear down in tests which still do that, now that mockito-junit-jupiter has been added to the build dependencies.

Fix resource loading in 'MakerTxValidatorSanityCheckTests', which breaks
when the working directory has spaces in its absolute path, due to the
fact that the test resource paths are URL encoded.

(This pattern is already used to load resources in a few other tests, so
there hopefully won't be a regression on Windows.)
Fix inspection warnings and other minor defects (unchecked casts, bad
'assert*' usage, unused assignments/declarations, missing null checks,
object equality on enum instances, needless statement lambdas, missing
final, redundant 'toString', needless visibility) in 'TxValidatorTest'.

Also, uniformise and slightly tidy resource loading in other test
classes, replacing 'Files.readAllBytes' with Java 11 'Files.readString'
(which assumes UTF-8 as desired, instead of the default charset).
Now that 'mockito-junit-jupiter' has been added to the build test
dependencies, we may replace the manual setup & tear down of a Mockito
session with the 'MockitoExtension' JUnit 5 test extension, as the old
Mockito JUnit 4 test runner was no longer available upon upgrading to
Jupiter. This slightly simplifies the tests which use '@mock', '@SPY',
etc.
Copy link
Contributor

@alvasw alvasw left a comment

Choose a reason for hiding this comment

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

ACK

Copy link
Contributor

@alejandrogarcia83 alejandrogarcia83 left a comment

Choose a reason for hiding this comment

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

utACK

@alejandrogarcia83 alejandrogarcia83 merged commit 588d57c into bisq-network:master Feb 6, 2024
3 checks passed
@alejandrogarcia83 alejandrogarcia83 added this to the v1.9.15 milestone Feb 6, 2024
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