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 two unit tests failing locally #4140

Merged

Conversation

cdegroc
Copy link
Contributor

@cdegroc cdegroc commented Nov 24, 2023

Fixes #4139


Thank you for contributing to JanusGraph!

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there an issue associated with this PR? Is it referenced in the commit message?
  • Does your PR body contain #xyz where xyz is the issue number you are trying to resolve?
  • Has your PR been rebased against the latest commit within the target branch (typically master)?
  • Is your initial contribution a single, squashed commit?

For code changes:

  • Have you written and/or updated unit tests to verify your changes?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE.txt file, including the main LICENSE.txt file in the root of this repository?
  • If applicable, have you updated the NOTICE.txt file, including the main NOTICE.txt file found in the root of this repository?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered?

Comment on lines -49 to +51
Mockito.doReturn(multiQuery).when(tx).multiQuery();
Mockito.doReturn(multiQuery).when(tx).multiQuery(anyCollection());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

💭 thought: When not specifying the multiQuery() argument type, the mocked method return‏s null (in my tests). Could it be because that method is overloaded and accepts both a Collection and varargs?

Assertions.assertEquals(10, suppressedExceptions.length);
for(int i=0; i<10; i++){
Assertions.assertTrue(suppressedExceptions[i] instanceof ExecutionException &&
suppressedExceptions[i].getCause() instanceof IllegalArgumentException);
Assertions.assertTrue(suppressedExceptions[i] instanceof IllegalArgumentException);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

📝 Based on the code of CompletableFutureUtil#unwrap and CompletableFutureUtil#unwrapExecutionException, it would make sense to me that the exceptions returned are not ExecutionExceptions but their "unwrapped" counterpart (IllegalStateException or IllegalArgumentException).

Copy link
Member

@porunov porunov Nov 30, 2023

Choose a reason for hiding this comment

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

You are right. Sorry I forgot to change that previously. Initially it was returning ExecutionException but after some fixes I changed this behavior and completely forgot about these Unit tests.

@cdegroc cdegroc marked this pull request as ready for review November 24, 2023 17:11
@janusgraph-bot janusgraph-bot added the cla: external Externally-managed CLA label Nov 25, 2023
Copy link
Member

@porunov porunov left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you @cdegroc !

Assertions.assertEquals(10, suppressedExceptions.length);
for(int i=0; i<10; i++){
Assertions.assertTrue(suppressedExceptions[i] instanceof ExecutionException &&
suppressedExceptions[i].getCause() instanceof IllegalArgumentException);
Assertions.assertTrue(suppressedExceptions[i] instanceof IllegalArgumentException);
}
Copy link
Member

@porunov porunov Nov 30, 2023

Choose a reason for hiding this comment

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

You are right. Sorry I forgot to change that previously. Initially it was returning ExecutionException but after some fixes I changed this behavior and completely forgot about these Unit tests.

@porunov porunov added this to the Release v1.1.0 milestone Nov 30, 2023
@porunov porunov merged commit abdc113 into JanusGraph:master Nov 30, 2023
105 checks passed
@janusgraph-automations
Copy link

💚 All backports created successfully

Status Branch Result
v1.0

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v1.0 cla: external Externally-managed CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JanusGraph v1.0 unit tests failing when ran locally
4 participants