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

AssetLineage OMAS UT fails with mockito 4.6.0 #6601

Closed
planetf1 opened this issue Jun 1, 2022 · 2 comments
Closed

AssetLineage OMAS UT fails with mockito 4.6.0 #6601

planetf1 opened this issue Jun 1, 2022 · 2 comments
Assignees
Labels
no-issue-activity Issues automatically marked as stale because they have not had recent activity.

Comments

@planetf1
Copy link
Member

planetf1 commented Jun 1, 2022

This month's Dependabot's updates included mockito 4.5.1 -> 4.6.0

With this update, Asset Lineage OMAS tests are failing in both maven and gradle.

gradle output is

AssetContextHandlerTest > buildAssetContext_dataFile() STANDARD_OUT
    [MockitoHint] org.odpi.openmetadata.accessservices.assetlineage.handlers.AssetContextHandlerTest (see javadoc for MockitoHint):
    [MockitoHint] 1. Unused... -> at org.odpi.openmetadata.accessservices.assetlineage.handlers.AssetContextHandlerTest.buildAssetContext_dataFile(AssetContextHandlerTest.java:163)
    [MockitoHint]  ...args ok? -> at org.odpi.openmetadata.accessservices.assetlineage.handlers.AssetContextHandler.addConnectionToAssetContext(AssetContextHandler.java:299)


AssetContextHandlerTest > buildAssetContext_dataFile() FAILED
    org.mockito.exceptions.misusing.PotentialStubbingProblem: 
    Strict stubbing argument mismatch. Please check:
     - this invocation of 'addContextForRelationships' method:
        handlerHelper.addContextForRelationships(
        "user",
        Mock for EntityDetail, hashCode: 2120115571,
        "ConnectionEndpoint",
        []
    );
        -> at org.odpi.openmetadata.accessservices.assetlineage.handlers.AssetContextHandler.addConnectionToAssetContext(AssetContextHandler.java:299)
     - has following stubbing(s) with different arguments:
        1. handlerHelper.addContextForRelationships(
        null,
        null,
        null,
        null
    );
          -> at org.odpi.openmetadata.accessservices.assetlineage.handlers.AssetContextHandlerTest.buildAssetContext_dataFile(AssetContextHandlerTest.java:163)
    Typically, stubbing argument mismatch indicates user mistake when writing tests.
    Mockito fails early so that you can debug potential problem easily.
    However, there are legit scenarios when this exception generates false negative signal:
      - stubbing the same method multiple times using 'given().will()' or 'when().then()' API
        Please use 'will().given()' or 'doReturn().when()' API for stubbing.
      - stubbed method is intentionally invoked with different arguments by code under test
        Please use default or 'silent' JUnit Rule (equivalent of Strictness.LENIENT).
    For more information see javadoc for PotentialStubbingProblem class.
        at app//org.odpi.openmetadata.accessservices.assetlineage.handlers.AssetContextHandler.addConnectionToAssetContext(AssetContextHandler.java:299)
        at app//org.odpi.openmetadata.accessservices.assetlineage.handlers.AssetContextHandler.buildDataFileContext(AssetContextHandler.java:315)
        at app//org.odpi.openmetadata.accessservices.assetlineage.handlers.AssetContextHandler.buildAssetContext(AssetContextHandler.java:144)
        at app//org.odpi.openmetadata.accessservices.assetlineage.handlers.AssetContextHandler.buildAssetContext(AssetContextHandler.java:124)
        at app//org.odpi.openmetadata.accessservices.assetlineage.handlers.AssetContextHandlerTest.buildAssetContext_dataFile(AssetContextHandlerTest.java:165)

This may indicate a problem with the test which should be fixed, and mockito upgraded in pom.xml & build.gradle to 4.6.0 or above.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 20 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the no-issue-activity Issues automatically marked as stale because they have not had recent activity. label Aug 10, 2022
@planetf1
Copy link
Member Author

The refactor of these tests has addressed this issue - so can close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-issue-activity Issues automatically marked as stale because they have not had recent activity.
Projects
No open projects
Development

No branches or pull requests

2 participants