use of org.eclipse.che.jface.text.contentassist.ICompletionProposalExtension5 in project che by eclipse.
the class CompletionJavadocTest method testInheredJavadoc.
@Test
public void testInheredJavadoc() throws Exception {
IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" /**\n");
buf.append(" * Test JavaDoc.\n");
buf.append(" */\n");
buf.append(" public void foo(int i) {\n");
buf.append(" }\n");
buf.append("}\n");
pack1.createCompilationUnit("E.java", buf.toString(), false, null);
StringBuffer buf2 = new StringBuffer();
buf2.append("package test1;\n");
buf2.append("public class B extends E {\n");
buf2.append(" @Override\n");
buf2.append(" public void foo(int i) {\n");
buf2.append(" foo(10);\n");
buf2.append(" }\n");
buf2.append("}\n");
ICompilationUnit cu2 = pack1.createCompilationUnit("B.java", buf2.toString(), false, null);
List<ICompletionProposal> proposals = computeProposals(cu2, buf2.indexOf(" foo") + " foo".length());
Assertions.assertThat(proposals).hasSize(1);
ICompletionProposal proposal = proposals.get(0);
String result;
if (proposal instanceof ICompletionProposalExtension5) {
result = ((ICompletionProposalExtension5) proposal).getAdditionalProposalInfo(null).toString();
} else {
result = proposal.getAdditionalProposalInfo();
}
Assertions.assertThat(result).contains("Test JavaDoc.");
}
use of org.eclipse.che.jface.text.contentassist.ICompletionProposalExtension5 in project che by eclipse.
the class CompletionJavadocTest method testJavadoc.
@Test
public void testJavadoc() throws Exception {
IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" /**\n");
buf.append(" * Test JavaDoc.\n");
buf.append(" */\n");
buf.append(" public void foo(int i) {\n");
buf.append(" foo(10);");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
List<ICompletionProposal> proposals = computeProposals(cu, buf.indexOf(" foo") + " foo".length());
Assertions.assertThat(proposals).hasSize(1);
ICompletionProposal proposal = proposals.get(0);
String result;
if (proposal instanceof ICompletionProposalExtension5) {
result = ((ICompletionProposalExtension5) proposal).getAdditionalProposalInfo(null).toString();
} else {
result = proposal.getAdditionalProposalInfo();
}
Assertions.assertThat(result).contains("Test JavaDoc.");
}
Aggregations