Author: akazakov
Date: 2010-04-28 14:55:26 -0400 (Wed, 28 Apr 2010)
New Revision: 21787
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6234 Added JUnit test.
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-04-28
17:56:44 UTC (rev 21786)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-04-28
18:55:26 UTC (rev 21787)
@@ -234,7 +234,8 @@
*/
public void testInitializerMethodHasParameterAnnotatedDisposes() throws Exception {
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/initializer/broken/parameterAnnotatedDisposes/Capercaillie_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DISPOSER_ANNOTATED_INJECT,
25, 26);
+ AbstractResourceMarkerTest.assertMarkerIsCreatedForGivenPosition(file,
AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DISPOSER_ANNOTATED_INJECT,
25, 1003, 1010);
+ AbstractResourceMarkerTest.assertMarkerIsCreatedForGivenPosition(file,
AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DISPOSER_ANNOTATED_INJECT,
26, 1048, 1057);
}
/**
Modified:
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java 2010-04-28
17:56:44 UTC (rev 21786)
+++
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java 2010-04-28
18:55:26 UTC (rev 21787)
@@ -118,6 +118,29 @@
}
}
+ public static void assertMarkerIsCreatedForGivenPosition(
+ IResource resource, String type, String pattern, int lineNumber,
+ int startPosition, int endPosition) throws CoreException {
+
+ IMarker[] markers = findMarkers(resource, type, pattern);
+ StringBuffer sb = new StringBuffer("[");
+ for (int i = 0; i < markers.length; i++) {
+ int line = markers[i].getAttribute(IMarker.LINE_NUMBER, -1);
+ int start = markers[i].getAttribute(IMarker.CHAR_START, -1);
+ int end = markers[i].getAttribute(IMarker.CHAR_END, -1);
+ if(lineNumber==line && start == startPosition && end == endPosition)
{
+ return;
+ }
+ if(i>0) {
+ sb.append("; ");
+ }
+ sb.append("line number - ").append(line).append(", start -
").append(start).append(", end - ").append(end);
+ }
+ sb.append("]");
+
+ fail("Marker matches the '" + pattern + "' pattern wasn't
found for line - " + lineNumber + ", start - " + startPosition + ",
end - " + endPosition + ". Found markers for given patern: " +
sb.toString()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
public static void assertMarkerIsNotCreated(IResource resource, String type, String
pattern) throws CoreException {
IMarker[] markers = findMarkers(resource, type, pattern);