Skip to content

Refactor Tests to instanceof pattern variable #2967

Closed
@arefbehboudi

Description

@arefbehboudi

In some of our test cases, we are currently using the traditional instanceof checks followed by explicit type casting. With the introduction of Pattern Matching in recent Java versions, we can refactor these checks to make the code more concise and readable.

Example:
if (redisOperations instanceof DisposableBean) { ((DisposableBean) redisOperations).destroy(); }

Tasks:

  • Locate instanceof checks in tests.
  • Refactor them to use Pattern Matching.
  • Ensure all tests pass after changes.

If this approach is approved, I will proceed with the changes and create a pull request.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions