Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » why a parser exception inside a converter is ignored by my test ?
why a parser exception inside a converter is ignored by my test ? [message #903686] Fri, 24 August 2012 21:44 Go to next message
Cristiano Gavião is currently offline Cristiano GaviãoFriend
Messages: 279
Registered: July 2009
Senior Member

I've created a test to evaluate an informed date:

	public void configureDateFormat(Binder binder) {


	def void testParsingLibraryAttributes() {
		val library = '''
			libraryID library.templates.core.base
				description "My description"
				creationDate "10/01/2012a"
				creator cvgaviao
		assertEquals("library.templates.core.base", library.getName())

	private String dateFormat;

protected Date internalToValue(String string, INode node)
					throws ValueConverterException {
				string = string.substring(1, string.length() - 1);

				try {
					SimpleDateFormat fmt = new SimpleDateFormat(dateFormat);
					return fmt.parse(string);
				} catch (Exception e) {
					// ignore and try timestamp format
					throw new ValueConverterException(
							"Not in timestamp format", node,
							new IllegalArgumentException());

With some debugging I could note that the converter is failing because a Illegal pattern character 'Y'. but the test are green...

could someone help to identify I'm missing ?


Re: why a parser exception inside a converter is ignored by my test ? [message #903688 is a reply to message #903686] Fri, 24 August 2012 21:51 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13709
Registered: July 2009
Senior Member

the parse helper does not give errors - you have to write a modified version (have a look at the source code)


Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Previous Topic:possibility to have one xtext editor for many files?
Next Topic:New Project Wizard without use XtextNewProjectWizard ?
Goto Forum:

Current Time: Sun Jan 17 17:31:32 GMT 2021

Powered by FUDForum. Page generated in 0.01597 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top