Author: vrubezhny
Date: 2010-10-18 10:39:26 -0400 (Mon, 18 Oct 2010)
New Revision: 25898
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/CANotEmptyWhenThereIsNoSpaceBetweenInvertedCommandsInAttributeJBIDE1759Test.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/CASuggestsNotOnlyELProposalsJBIDE2437Test.java
Log:
JBIDE-7195
org.jboss.tools.jsf.ui.test fails
CA Proposals collecting is fixed
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/CANotEmptyWhenThereIsNoSpaceBetweenInvertedCommandsInAttributeJBIDE1759Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/CANotEmptyWhenThereIsNoSpaceBetweenInvertedCommandsInAttributeJBIDE1759Test.java 2010-10-18
13:34:39 UTC (rev 25897)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/CANotEmptyWhenThereIsNoSpaceBetweenInvertedCommandsInAttributeJBIDE1759Test.java 2010-10-18
14:39:26 UTC (rev 25898)
@@ -86,22 +86,15 @@
ICompletionProposal[] result= null;
String errorMessage = null;
- IContentAssistProcessor p= TestUtil.getProcessor(viewer, offsetToTest,
contentAssistant);
- if (p != null) {
- try {
- result= p.computeCompletionProposals(viewer, offsetToTest);
- } catch (Throwable x) {
- x.printStackTrace();
- }
- errorMessage= p.getErrorMessage();
- }
-
+ List<ICompletionProposal> res = TestUtil.collectProposals(contentAssistant,
viewer, offsetToTest);
+ assertTrue("Content Assistant returned no proposals", (res != null
&& res.size() > 0)); //$NON-NLS-1$
+
List<String> customCompletionProposals = new ArrayList<String>();
- for (int i = 0; i < result.length; i++) {
+ for (ICompletionProposal p : res) {
// There should be at least one proposal of type CustomCompletionProposal in the
result
- if (result[i] instanceof CustomCompletionProposal) {
- customCompletionProposals.add(((CustomCompletionProposal)result[i]).getReplacementString());
+ if (p instanceof CustomCompletionProposal) {
+ customCompletionProposals.add(((CustomCompletionProposal)p).getReplacementString());
}
}
assertFalse("Content Assistant returned no proposals of type
CustomCompletionProposal.",customCompletionProposals.isEmpty());
@@ -124,22 +117,16 @@
jspTextEditor.setText(documentContentModified);
- p= TestUtil.getProcessor(viewer, offsetToTest, contentAssistant);
- if (p != null) {
- try {
- result= p.computeCompletionProposals(viewer, offsetToTest);
- } catch (Throwable x) {
- x.printStackTrace();
- }
- errorMessage= p.getErrorMessage();
- }
+ res = TestUtil.collectProposals(contentAssistant, viewer, offsetToTest);
- for (int i = 0; i < result.length; i++) {
+ assertTrue("Content Assistant returned no proposals", (res != null
&& res.size() > 0)); //$NON-NLS-1$
+
+ for (ICompletionProposal p : res) {
// There should be the same proposals as in the saved result
- if (result[i] instanceof CustomCompletionProposal) {
+ if (p instanceof CustomCompletionProposal) {
assertTrue("Content Assistant returned additional proposal (proposal returned
doesn't exist in the saved list).",
- customCompletionProposals.contains(((CustomCompletionProposal)result[i]).getReplacementString()));
- customCompletionProposals.remove(((CustomCompletionProposal)result[i]).getReplacementString());
+ customCompletionProposals.contains(((CustomCompletionProposal)p).getReplacementString()));
+ customCompletionProposals.remove(((CustomCompletionProposal)p).getReplacementString());
}
}
assertTrue("Content Assistant didn't return some of the required
proposals.",customCompletionProposals.isEmpty());
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/CASuggestsNotOnlyELProposalsJBIDE2437Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/CASuggestsNotOnlyELProposalsJBIDE2437Test.java 2010-10-18
13:34:39 UTC (rev 25897)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/CASuggestsNotOnlyELProposalsJBIDE2437Test.java 2010-10-18
14:39:26 UTC (rev 25898)
@@ -1,5 +1,7 @@
package org.jboss.tools.jsf.jsp.ca.test;
+import java.util.List;
+
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -42,16 +44,16 @@
IRegion reg = new FindReplaceDocumentAdapter(document).find(0,
"/templates/common.xhtml", true, true, false, false);
- IContentAssistProcessor p= TestUtil.getProcessor(viewer, reg.getOffset(),
contentAssistant);
- assertNotNull("Cannot obtain IContentAssistProcessor instance",p);
- result= p.computeCompletionProposals(viewer, reg.getOffset());
-
+ List<ICompletionProposal> res = TestUtil.collectProposals(contentAssistant,
viewer, reg.getOffset());
+
+ assertTrue("Content Assistant returned no proposals", (res != null
&& res.size() > 0)); //$NON-NLS-1$
+
boolean bELProposalsFound = false;
boolean bTemplatePathProposalsFound = false;
- for (int k = 0; result != null && k < result.length &&
+ for (int k = 0;
(!bELProposalsFound || !bTemplatePathProposalsFound); k++) {
- if (result[k] instanceof AutoContentAssistantProposal) {
- AutoContentAssistantProposal proposal = (AutoContentAssistantProposal)result[k];
+ if (res.get(k) instanceof AutoContentAssistantProposal) {
+ AutoContentAssistantProposal proposal = (AutoContentAssistantProposal)res.get(k);
// Test the display string for the proposals - it has to shown the thmplate path
beginning or EL-expression beginning
// because the CA is started the calculation from the very beginning of the attribute
value.
Show replies by date