Author: estherbin
Date: 2008-06-10 05:32:02 -0400 (Tue, 10 Jun 2008)
New Revision: 8666
Added:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/Jbide1791Test.java
Log:
Write junit for
http://jira.jboss.com/jira/browse/JBIDE-1791 issue.
Added:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/Jbide1791Test.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/Jbide1791Test.java
(rev 0)
+++
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/Jbide1791Test.java 2008-06-10
09:32:02 UTC (rev 8666)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.test.ca;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.jboss.tools.common.test.util.TestProjectProvider;
+
+/**
+ * Test cast testing
http://jira.jboss.com/jira/browse/JBIDE-1791 issue.
+ *
+ * @author Eugene Stherbin
+ *
+ */
+public class Jbide1791Test extends ContentAssistantTestCase {
+ private static final String PROJECT_NAME = "JsfJbide1791Test";
+ private static final String PAGE_NAME =
"/WebContent/pages/jbide1791.xhtml";
+ private TestProjectProvider provider = null;
+
+ public static Test suite() {
+ return new TestSuite(Jbide1791Test.class);
+ }
+ public void setUp() throws Exception {
+ provider = new TestProjectProvider("org.jboss.tools.jst.jsp.test",
null, PROJECT_NAME,false);
+ project = provider.getProject();
+ Throwable exception = null;
+ try {
+ project.refreshLocal(IResource.DEPTH_INFINITE, null);
+ } catch (Exception x) {
+ exception = x;
+ x.printStackTrace();
+ }
+ assertNull("An exception caught: " + (exception != null?
exception.getMessage() : ""), exception);
+ }
+
+ protected void tearDown() throws Exception {
+ if(provider != null) {
+ provider.dispose();
+ }
+ }
+ public void testJbide1791(){
+ final String[] proposals = new String[]{
+ "h1",
+ "h2",
+ "h3",
+ "h4",
+ "h5",
+ "h6",
+ "hr"
+ };
+ final ICompletionProposal[] rst = checkProposals(PAGE_NAME,353, proposals,
false);
+
+ checkResult(rst,proposals);
+ }
+ /**
+ * @param rst
+ * @param proposals
+ */
+ private void checkResult(ICompletionProposal[] rst, String[] proposals) {
+ for ( int i = 0 ; i < proposals.length ; i ++ ){
+ assertTrue("Should be in proposals
list",isInResultList(rst,proposals[i]));
+ }
+
+ }
+ /**
+ * @param rst
+ * @param string
+ * @return
+ */
+ private boolean isInResultList(ICompletionProposal[] rst, String string) {
+ boolean r = false;
+
+ for(ICompletionProposal cp:rst){
+ if(cp.getDisplayString().equals(string)){
+ r = true;
+ break;
+ }
+ }
+ return r;
+ }
+}
Property changes on:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/Jbide1791Test.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native