Author: akazakov
Date: 2008-06-20 14:08:51 -0400 (Fri, 20 Jun 2008)
New Revision: 8880
Modified:
branches/jbosstools-2.1.x/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsAllTests.java
branches/jbosstools-2.1.x/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
branches/jbosstools-2.1.x/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
Log:
JUnit tests fixed
Modified:
branches/jbosstools-2.1.x/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsAllTests.java
===================================================================
---
branches/jbosstools-2.1.x/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsAllTests.java 2008-06-20
18:02:54 UTC (rev 8879)
+++
branches/jbosstools-2.1.x/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsAllTests.java 2008-06-20
18:08:51 UTC (rev 8880)
@@ -13,6 +13,12 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.test.util.JUnitUtils;
import org.jboss.tools.test.util.ProjectImportTestSetup;
/**
@@ -23,7 +29,19 @@
public static Test suite() {
TestSuite suite = new TestSuite();
- suite.addTest(new ProjectImportTestSetup(new
TestSuite(SeamValidatorsTest.class),"org.jboss.tools.seam.core.test","projects/SeamWebWarTestProject","SeamWebWarTestProject"));
+ suite.addTest(new ProjectImportTestSetup(new
TestSuite(SeamValidatorsTest.class),"org.jboss.tools.seam.core.test","projects/SeamWebWarTestProject","SeamWebWarTestProject")
{
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ IResource project =
ResourcesPlugin.getWorkspace().getRoot().findMember("SeamWebWarTestProject");
+ try {
+ // Configure seam nature to switch off WTP JSF Variable resolver.
+ ((IProjectNature)SeamCorePlugin.getSeamProject((IProject)project,
false)).configure();
+ } catch (Exception e) {
+ JUnitUtils.fail("Cannot configure seam nature.", e);
+ }
+ }
+ } );
suite.addTest(new ProjectImportTestSetup(new
TestSuite(SeamProjectPropertyValidatorTest.class),
"org.jboss.tools.seam.core.test",
new String[]{"projects/RefactoringTestProject-war",
"projects/RefactoringTestProject-ejb",
"projects/RefactoringTestProject-test"},
Modified:
branches/jbosstools-2.1.x/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
===================================================================
---
branches/jbosstools-2.1.x/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2008-06-20
18:02:54 UTC (rev 8879)
+++
branches/jbosstools-2.1.x/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2008-06-20
18:08:51 UTC (rev 8880)
@@ -60,7 +60,7 @@
this.project.build(IncrementalProjectBuilder.FULL_BUILD, null);
EditorTestHelper.joinBackgroundActivities();
}
-
+
public void tearDown() throws Exception {
if(project != null){
EditorTestHelper.joinBackgroundActivities();
@@ -90,12 +90,7 @@
*/
public void testJBIDE1318() throws CoreException {
IFile testJSP = project.getFile("WebContent/test.jsp");
- String[] messages = getMarkersMessage(testJSP);
- StringBuffer error = new StringBuffer("Problem markers were found in
WebContent/test.jsp: ");
- for (int i = 0; i < messages.length; i++) {
- error.append(messages[i]).append("; ");
- }
- assertTrue(error.toString(), messages.length==0);
+ assertMarkerIsNotCreated(testJSP, null, "actor cannot be resolved");
}
public void testVarAttributes() throws CoreException {
Modified:
branches/jbosstools-2.1.x/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
===================================================================
---
branches/jbosstools-2.1.x/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java 2008-06-20
18:02:54 UTC (rev 8879)
+++
branches/jbosstools-2.1.x/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java 2008-06-20
18:08:51 UTC (rev 8880)
@@ -64,6 +64,7 @@
protected void assertMarkerIsCreated(IResource resource, MarkerData markerData) throws
CoreException {
assertMarkerIsCreated(resource, markerData.type, markerData.pattern, markerData.line);
+
}
protected void assertMarkerIsCreated(IResource resource, String type, String pattern,
int expectedLine)
@@ -79,6 +80,18 @@
expectedLine,line);
}
+ protected void assertMarkerIsNotCreated(IResource resource, String type, String pattern)
throws CoreException {
+ IMarker[] markers = findMarkers(resource, type, pattern);
+
+ assertFalse("Marker matches the '" + pattern + "' pattern was
found", markers.length>0);
+ }
+
+ protected void assertMarkerIsNotCreated(IResource resource, String type, String pattern,
int expectedLine) throws CoreException {
+ int line = findMarkerLine(resource, type, pattern);
+
+ assertFalse("Marker matches the '" + pattern + "' pattern was
found", line != -1);
+ }
+
protected void assertMarkerIsCreated(IResource resource, String type, String pattern)
throws CoreException {
IMarker[] markers = findMarkers(resource, type, pattern);