Author: mareshkau
Date: 2011-02-24 12:32:00 -0500 (Thu, 24 Feb 2011)
New Revision: 29318
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/I18nValidatorTest.java
Log:
https://issues.jboss.org/browse/JBIDE-7003, one more test case of changing severity has
been added to junit
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/I18nValidatorTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/I18nValidatorTest.java 2011-02-24
17:15:05 UTC (rev 29317)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/I18nValidatorTest.java 2011-02-24
17:32:00 UTC (rev 29318)
@@ -57,4 +57,30 @@
"By Default I18nValidator should be ignored",
ELSeverityPreferences.IGNORE,//$NON-NLS-1$
store.getDefaultString(ELSeverityPreferences.NON_EXTERNALIZED_STRINGS));
}
+
+ public void testChangeMarkerSeverity() throws CoreException {
+ IFile testFile =
getProject().getFile("WebContent/externalization-validator-test-case-1.xhtml");
//$NON-NLS-1$
+ testFile.deleteMarkers(I18nValidationComponent.PROBLEM_ID, true,
IResource.DEPTH_ZERO);
+ IMarker[] elMarkers = testFile.findMarkers(I18nValidationComponent.PROBLEM_ID, true,
IResource.DEPTH_ZERO);
+ //changing severity level on ignoring(disable validator)
+ store.setValue(ELSeverityPreferences.NON_EXTERNALIZED_STRINGS,
ELSeverityPreferences.IGNORE);
+ assertEquals("Markers should be cleaned", 0,elMarkers.length); //$NON-NLS-1$
+ ValidationFramework.getDefault().validate(testFile, new NullProgressMonitor());
+ elMarkers = testFile.findMarkers(I18nValidationComponent.PROBLEM_ID, true,
IResource.DEPTH_ZERO);
+ assertEquals("There shouldn't be any validation markers",
0,elMarkers.length); //$NON-NLS-1$
+ //changing severity level on warning
+ store.setValue(ELSeverityPreferences.NON_EXTERNALIZED_STRINGS,
ELSeverityPreferences.WARNING);
+ ValidationFramework.getDefault().validate(testFile, new NullProgressMonitor());
+ elMarkers = testFile.findMarkers(I18nValidationComponent.PROBLEM_ID, true,
IResource.DEPTH_ZERO);
+ assertEquals("There shouldn't be 2 validation markers",
2,elMarkers.length); //$NON-NLS-1$
+ assertEquals("Marker Severity should be
warning",(Integer)IMarker.SEVERITY_WARNING,
(Integer)elMarkers[0].getAttribute(IMarker.SEVERITY));//$NON-NLS-1$
+
+ //changing severity level on warning
+ store.setValue(ELSeverityPreferences.NON_EXTERNALIZED_STRINGS,
ELSeverityPreferences.ERROR);
+ ValidationFramework.getDefault().validate(testFile, new NullProgressMonitor());
+ elMarkers = testFile.findMarkers(I18nValidationComponent.PROBLEM_ID, true,
IResource.DEPTH_ZERO);
+ assertEquals("There shouldn't be 2 validation markers",
2,elMarkers.length); //$NON-NLS-1$
+ assertEquals("Marker Severity should be
warning",(Integer)IMarker.SEVERITY_ERROR,
(Integer)elMarkers[0].getAttribute(IMarker.SEVERITY));//$NON-NLS-1$
+
+ }
}