本文整理汇总了Java中org.eclipse.wst.validation.internal.provisional.core.IReporter.getMessages方法的典型用法代码示例。如果您正苦于以下问题:Java IReporter.getMessages方法的具体用法?Java IReporter.getMessages怎么用?Java IReporter.getMessages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.wst.validation.internal.provisional.core.IReporter
的用法示例。
在下文中一共展示了IReporter.getMessages方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import org.eclipse.wst.validation.internal.provisional.core.IReporter; //导入方法依赖的package包/类
private List validate(String html) throws CoreException {
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("test");
if (!project.exists()) {
project.create(new NullProgressMonitor());
project.open(new NullProgressMonitor());
}
// Add tsconfig.json in order to the project has angular nature
IFile tsconfigJson = project.getFile("tsconfig.json");
if (!tsconfigJson.exists()) {
tsconfigJson.create(IOUtils.toInputStream("{}"), 1, new NullProgressMonitor());
}
IFile file = project.getFile("test.html");
if (file.exists()) {
file.setContents(IOUtils.toInputStream(html), 1, new NullProgressMonitor());
} else {
file.create(IOUtils.toInputStream(html), 1, new NullProgressMonitor());
}
HTMLValidator validator = new HTMLValidator();
ValidationResult result = validator.validate(file, 1, new ValidationState(), new NullProgressMonitor());
IReporter reporter = result.getReporter(new NullProgressMonitor());
return reporter.getMessages();
}
示例2: missingEndObject
import org.eclipse.wst.validation.internal.provisional.core.IReporter; //导入方法依赖的package包/类
@Test
public void missingEndObject() throws Exception {
IReporter reporter = validate("{");
List messages = reporter.getMessages();
Assert.assertEquals(1, messages.size());
LocalizedMessage msg = (LocalizedMessage) messages.get(0);
assertMessage(msg, "Missing end object", 1, 1);
}
示例3: missingEndArray
import org.eclipse.wst.validation.internal.provisional.core.IReporter; //导入方法依赖的package包/类
@Test
public void missingEndArray() throws Exception {
IReporter reporter = validate("[");
List messages = reporter.getMessages();
Assert.assertEquals(1, messages.size());
LocalizedMessage msg = (LocalizedMessage) messages.get(0);
assertMessage(msg, "Missing end array", 1, 1);
}
示例4: unexpectedColonInArray
import org.eclipse.wst.validation.internal.provisional.core.IReporter; //导入方法依赖的package包/类
@Test
public void unexpectedColonInArray() throws Exception {
IReporter reporter = validate("[\"a\":]");
List messages = reporter.getMessages();
Assert.assertEquals(1, messages.size());
LocalizedMessage msg = (LocalizedMessage) messages.get(0);
assertMessage(msg, "Unexpected token", 1, 1);
}
示例5: badObjectKey
import org.eclipse.wst.validation.internal.provisional.core.IReporter; //导入方法依赖的package包/类
@Test
@Ignore
public void badObjectKey() throws Exception {
IReporter reporter = validate("{aa}");
List messages = reporter.getMessages();
Assert.assertEquals(1, messages.size());
LocalizedMessage msg = (LocalizedMessage) messages.get(0);
assertMessage(msg, "Expected object key but found undefined", 1, 1);
// msg = (LocalizedMessage) messages.get(1);
// assertMessage(msg, "Unexpected token", 1, 1);
}
示例6: noErrorsWithObject
import org.eclipse.wst.validation.internal.provisional.core.IReporter; //导入方法依赖的package包/类
@Test
public void noErrorsWithObject() throws Exception {
IReporter reporter = validate("{}");
List messages = reporter.getMessages();
Assert.assertEquals(0, messages.size());
}
示例7: noErrorsWithArray
import org.eclipse.wst.validation.internal.provisional.core.IReporter; //导入方法依赖的package包/类
@Test
public void noErrorsWithArray() throws Exception {
IReporter reporter = validate("[]");
List messages = reporter.getMessages();
Assert.assertEquals(0, messages.size());
}
示例8: objectsInArray
import org.eclipse.wst.validation.internal.provisional.core.IReporter; //导入方法依赖的package包/类
@Test
public void objectsInArray() throws Exception {
IReporter reporter = validate("[{},{}]");
List messages = reporter.getMessages();
Assert.assertEquals(0, messages.size());
}