Search in sources :

Example 1 with RichTextValueConverter

use of org.eclipse.xtend.core.conversion.RichTextValueConverter in project xtext-xtend by eclipse.

the class RichTextValueConverterTest method testRichText.

@Test
public void testRichText() {
    String text = "''' foobar '''";
    String expectation = " foobar ";
    RichTextValueConverter converter = get(RichTextValueConverter.class);
    String value = converter.toValue(text, null);
    assertEquals(expectation, value);
}
Also used : RichTextValueConverter(org.eclipse.xtend.core.conversion.RichTextValueConverter) Test(org.junit.Test)

Example 2 with RichTextValueConverter

use of org.eclipse.xtend.core.conversion.RichTextValueConverter in project xtext-xtend by eclipse.

the class RichTextValueConverterTest method doTestIncompleteRichString.

protected void doTestIncompleteRichString(String text, String expectation) {
    RichTextValueConverter converter = get(RichTextValueConverter.class);
    try {
        converter.toValue(text, null);
        fail("Expected ValueConverterWithValueException");
    } catch (ValueConverterWithValueException e) {
        String value = (String) e.getValue();
        assertEquals(expectation, value);
    }
}
Also used : ValueConverterWithValueException(org.eclipse.xtext.conversion.ValueConverterWithValueException) RichTextValueConverter(org.eclipse.xtend.core.conversion.RichTextValueConverter)

Aggregations

RichTextValueConverter (org.eclipse.xtend.core.conversion.RichTextValueConverter)2 ValueConverterWithValueException (org.eclipse.xtext.conversion.ValueConverterWithValueException)1 Test (org.junit.Test)1