-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add tests for semantic ordering after creation on top of lifeline #1
Conversation
This change addresses comment #343#issuecomment-418037298 (third comment) of #343. When inserting an execution specification as first element (execParams.isInsertBefore) of a lifeline, the isInsertBefore flag has not been respected when invoking the nudge command. Signed-off-by: Philip Langer <planger@eclipsesource.com>
Signed-off-by: Philip Langer <planger@eclipsesource.com>
Signed-off-by: Philip Langer <planger@eclipsesource.com>
Please note that three of the tests currently still fail which should be inline with the issues documented in eclipsesource#331 (comment). |
Signed-off-by: Philip Langer <planger@eclipsesource.com>
Please also note that there is no need to review the commits before the merge in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tests, @planger! I'll address my own comments when I merge this and then can get to work on fixing stuff to make the failing tests pass.
public Optional<MExecution> getMExecution(ExecutionSpecification execution) { | ||
Optional<MElement<? extends ExecutionSpecification>> element = getMInteraction() | ||
.getElement(execution); | ||
if (element.isPresent() && element.get() instanceof MExecution) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The usual way to do this is
return element.filter(MExecution.class::isInstance).map(MExecution.class::cast);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(y)
@SuppressWarnings({"boxing" }) | ||
public Object isSemanticallyBefore(MOccurrence<? extends Element> one, | ||
MOccurrence<? extends Element> other) { | ||
EList<InteractionFragment> fragments = getMInteraction().getElement().getFragments(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory, we should be able to rely on the Graph
API for this, specifically the Vertex::precedes(Vertex)
query. Does that present any problem? I can check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I don't think it would present a problem. I just purposefully bypassed the graph to be sure the assertion would test directly on the UML model, as it kind of is the goal of the test. However, since the vertex is essentially "only" a facade over the UML model, we might as well use it.
} | ||
|
||
@Test | ||
@SuppressWarnings({"boxing" }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should configure the test projects to ignore boxing. The annotations are so much noise ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(y)
import org.eclipse.uml2.uml.Message; | ||
|
||
@SuppressWarnings("restriction") | ||
public class ModelEditFixture extends Edit { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! We've needed this for a while. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, glad you like it!
...action.model.tests/src/org/eclipse/papyrus/uml/interaction/model/tests/ModelEditFixture.java
Show resolved
Hide resolved
Thanks for the feedback and for addressing your comments! |
These changes are squashed and merged to my branch. |
Adds tests for issues eclipsesource#343 and eclipsesource#347. To enable more efficient adding of
testing, this change also refactors the tests a bit and extracts common
methods into dedicated model fixture.