Test & fix for Bug 331726 - Selectionmechanism missing on right ShortMethodSpec Callout to field
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/selection/org/eclipse/objectteams/otdt/tests/selection/codeselect/CodeSelectionTests.java b/testplugins/org.eclipse.objectteams.otdt.tests/selection/org/eclipse/objectteams/otdt/tests/selection/codeselect/CodeSelectionTests.java
index 14fca49..316fcb1 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/selection/org/eclipse/objectteams/otdt/tests/selection/codeselect/CodeSelectionTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/selection/org/eclipse/objectteams/otdt/tests/selection/codeselect/CodeSelectionTests.java
@@ -288,6 +288,19 @@
"rm2(int) -> bm1(int) [in R [in MappingsTeam1 [in MappingsTeam1.java [in mappings [in src [in CodeSelection]]]]]]",
elements);
}
+
+ /**
+ * Select a callout mapping (role method spec)
+ */
+ public void testCalloutToFieldShorthand() throws JavaModelException
+ {
+ ICompilationUnit cu = getCompilationUnit("CodeSelection", "src", "mappings", "MappingsTeam1.java");
+ IJavaElement[] elements = codeSelect(cu, "jon; // c-t-f shorthand", "jon");
+ assertElementsEqual(
+ "Unexpected elements",
+ "jon [in B1 [in B1.java [in basepkg [in src [in CodeSelection]]]]]",
+ elements);
+ }
/**
* Select argument name inside a callin parameter mapping.
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/workspace/CodeSelection/src/mappings/MappingsTeam1.java b/testplugins/org.eclipse.objectteams.otdt.tests/workspace/CodeSelection/src/mappings/MappingsTeam1.java
index a4eb5ae..37acbf8 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/workspace/CodeSelection/src/mappings/MappingsTeam1.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/workspace/CodeSelection/src/mappings/MappingsTeam1.java
@@ -22,5 +22,7 @@
int doubleIt(int in) <- after int bm1(int x)
with { result <- (int)jon } // callin
+ abstract long shortHandJon();
+ shortHandJon -> get jon; // c-t-f shorthand
}
}