Skip to content

Issue#1290 refactor sim functions tests#1291

Open
padam-prakash wants to merge 3 commits intozinggAI:mainfrom
padam-prakash:Issue#1290RefactorSimFunctionsTests
Open

Issue#1290 refactor sim functions tests#1291
padam-prakash wants to merge 3 commits intozinggAI:mainfrom
padam-prakash:Issue#1290RefactorSimFunctionsTests

Conversation

@padam-prakash
Copy link
Copy Markdown
Contributor

closes #1290 . Introduce SimilarityFunctionTestHelper to centralize common null/empty and exact-match checks for similarity functions. Refactor TestEmailMatchTypeFunction and TestOnlyAlphabetsAffineGapSimilarity to use the helper, reorganize and add test cases.

Introduce SimilarityFunctionTestHelper to centralize common null/empty and exact-match checks for similarity functions. Refactor TestEmailMatchTypeFunction and TestOnlyAlphabetsAffineGapSimilarity to use the helper, reorganize and add test cases.
Replace string concatenation of the caught exception with passing it as the cause to the ZinggClientException constructor. This preserves the original exception and its stack trace (change in TrainingDataFinder.java catch block).
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors similarity-function unit tests to reduce duplication by introducing a shared test helper for common behaviors (null/empty handling and exact-match checks), and updates an exception message typo in TrainingDataFinder.

Changes:

  • Added SimilarityFunctionTestHelper to centralize common similarity-function assertions.
  • Refactored TestEmailMatchTypeFunction and TestOnlyAlphabetsAffineGapSimilarity to use the helper and reorganized test cases.
  • Updated a ZinggClientException message in TrainingDataFinder.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
common/core/src/test/java/zingg/common/core/similarity/function/TestOnlyAlphabetsAffineGapSimilarity.java Refactors tests to reuse shared null/empty and exact-match assertions, and keeps function-specific cases.
common/core/src/test/java/zingg/common/core/similarity/function/TestEmailMatchTypeFunction.java Refactors tests to reuse shared assertions and keeps email-specific delegation behavior tests.
common/core/src/test/java/zingg/common/core/similarity/function/SimilarityFunctionTestHelper.java Adds shared test utilities for common similarity-function behavior.
common/core/src/main/java/zingg/common/core/executor/TrainingDataFinder.java Fixes/updates an exception message string.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Update wording for clarity: change exception message in TrainingDataFinder to "Error while finding training data" and simplify Javadoc comments in SimilarityFunctionTestHelper by removing redundant phrase about usage
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.

Refactor similarity function tests

2 participants