Skip to content

HDDS-9993. Add static import for assertions and mocks in hdds-server-scm#5914

Closed
raju-balpande wants to merge 4 commits intoapache:masterfrom
raju-balpande:raju-b-hdds-9993
Closed

HDDS-9993. Add static import for assertions and mocks in hdds-server-scm#5914
raju-balpande wants to merge 4 commits intoapache:masterfrom
raju-balpande:raju-b-hdds-9993

Conversation

@raju-balpande
Copy link
Contributor

What changes were proposed in this pull request?

Add static import for assertions and mocks in hadoop-hdds/server-scm.
he goal of this task is to add import static for all assertions and interactions with mocks. Replacing:

Assertions.assert(...) -> assert(...)
Assertions.fail(...) -> fail(...)

and

Mockito.mock(...) -> mock(...)
Mockito.verify(...) -> verify(...)
Mockito.when(...) -> when(...)
...

and

ArgumentMatchers.any() -> any()
ArgumentMatchers.eq() -> eq()
ArgumentMatchers.matches() -> matches()
// also:
// Matchers.<...>()

  • makes the code more readable (shorter lines, less wrapping).
  • Corrected argument sequence at some places in assertEquals to expected, actual.
  • Modified try{ fail() ) catch to assertThrows for the suitable cases.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-9993

How was this patch tested?

Tested the test cases in CI-CD pipeline.

@raju-balpande raju-balpande marked this pull request as ready for review January 3, 2024 14:54
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.

1 participant