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

Many tests try to check matchedVertex incorrectly #3120

Closed
t92549 opened this issue Nov 24, 2023 · 0 comments · Fixed by #3131
Closed

Many tests try to check matchedVertex incorrectly #3120

t92549 opened this issue Nov 24, 2023 · 0 comments · Fixed by #3131
Assignees
Labels
bug Confirmed or suspected bug
Milestone

Comments

@t92549
Copy link
Contributor

t92549 commented Nov 24, 2023

Describe the bug
There are tests in Gaffer where an assertion is made that a results Edge is the same as an expected Edge, and the matchedVertex has an expected result, e.g.:

final Edge expectedEdge = new Edge.Builder()
.group(TestGroups.EDGE)
.source(NEW_SOURCE)
.dest(NEW_DEST)
.directed(false)
.matchedVertex(EdgeId.MatchedVertex.DESTINATION)
.build();

However, they are just relying on the Edge.equals method which explicitly ignores matchedVertex:

* Note this does not include the matchedVertex field.
*
* @param obj the reference object with which to compare.
* @return {@code true} if this object is the same as the obj
* argument; {@code false} otherwise.
*/
@Override
public boolean equals(final Object obj) {

These tests should be fixed to properly check matchedVertex is as expected, e.g.:

assertEquals("source vertex", edge.getMatchedVertexValue());

Or, perhaps a custom condition should be made, similar to:

Condition<Edge> matchedVertex = new Condition<>(
edge -> null != edge.getMatchedVertex(), "matched vertex");

@t92549 t92549 added the bug Confirmed or suspected bug label Nov 24, 2023
@t92549 t92549 added this to the v2.2.0 milestone Nov 24, 2023
@t92549 t92549 self-assigned this Dec 1, 2023
t92549 added a commit that referenced this issue Jan 2, 2024
Co-authored-by: GCHQDeveloper314 <94527357+GCHQDeveloper314@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed or suspected bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant