Search in sources :

Example 1 with MarkupLanguageProvider

use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguageProvider in project mylyn.docs by eclipse.

the class MarkupLanguageProviderTest method getMarkupLanguagesNullName.

@Test
public void getMarkupLanguagesNullName() {
    MarkupLanguageProvider provider = new MarkupLanguageProvider() {

        @Override
        protected Set<MarkupLanguage> loadMarkupLanguages() {
            MockMarkupLanguage language = new MockMarkupLanguage();
            language.setName(null);
            return ImmutableSet.<MarkupLanguage>of(language);
        }
    };
    thrown.expect(NullPointerException.class);
    thrown.expectMessage("Provided languages must have a name");
    provider.getMarkupLanguages();
}
Also used : MockMarkupLanguage(org.eclipse.mylyn.internal.wikitext.MockMarkupLanguage) MockMarkupLanguage(org.eclipse.mylyn.internal.wikitext.MockMarkupLanguage) MarkupLanguage(org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage) MarkupLanguageProvider(org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguageProvider) Test(org.junit.Test)

Example 2 with MarkupLanguageProvider

use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguageProvider in project mylyn.docs by eclipse.

the class MarkupLanguageProviderTest method getMarkupLanguages.

@Test
public void getMarkupLanguages() {
    MarkupLanguageProvider provider = new TestLanguageProvider();
    assertNotNull(provider.getMarkupLanguages());
    assertEquals(1, provider.getMarkupLanguages().size());
    assertEquals("Test", provider.getMarkupLanguages().iterator().next().getName());
}
Also used : MarkupLanguageProvider(org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguageProvider) Test(org.junit.Test)

Example 3 with MarkupLanguageProvider

use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguageProvider in project mylyn.docs by eclipse.

the class MarkupLanguageProviderTest method getMarkupLanguagesNull.

@Test
public void getMarkupLanguagesNull() {
    MarkupLanguageProvider provider = new MarkupLanguageProvider() {

        @Override
        protected Set<MarkupLanguage> loadMarkupLanguages() {
            return null;
        }
    };
    thrown.expect(NullPointerException.class);
    thrown.expectMessage("loadMarkupLanguages() must not return null");
    provider.getMarkupLanguages();
}
Also used : MockMarkupLanguage(org.eclipse.mylyn.internal.wikitext.MockMarkupLanguage) MarkupLanguage(org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage) MarkupLanguageProvider(org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguageProvider) Test(org.junit.Test)

Example 4 with MarkupLanguageProvider

use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguageProvider in project mylyn.docs by eclipse.

the class MarkupLanguageProviderTest method getMarkupLanguagesDuplicatedNames.

@Test
public void getMarkupLanguagesDuplicatedNames() {
    MarkupLanguageProvider provider = new MarkupLanguageProvider() {

        @Override
        protected Set<MarkupLanguage> loadMarkupLanguages() {
            return ImmutableSet.<MarkupLanguage>of(new MockMarkupLanguage("Test"), new MockMarkupLanguage("Test"));
        }
    };
    thrown.expect(IllegalStateException.class);
    thrown.expectMessage("Language name 'Test' must not be provided more than once");
    provider.getMarkupLanguages();
}
Also used : MockMarkupLanguage(org.eclipse.mylyn.internal.wikitext.MockMarkupLanguage) MockMarkupLanguage(org.eclipse.mylyn.internal.wikitext.MockMarkupLanguage) MarkupLanguage(org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage) MarkupLanguageProvider(org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguageProvider) Test(org.junit.Test)

Aggregations

MarkupLanguageProvider (org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguageProvider)4 Test (org.junit.Test)4 MockMarkupLanguage (org.eclipse.mylyn.internal.wikitext.MockMarkupLanguage)3 MarkupLanguage (org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage)3