package de.tudarmstadt.ukp.wikipedia.api; import org.junit.Assume; import org.junit.Test; import static org.junit.Assert.*; import de.tudarmstadt.ukp.wikipedia.api.exception.WikiTitleParsingException; public class TestTitle { @Test public void TitleConstructorTest() { Title t = null; boolean exception = false; try { t = new Title(""); } catch(WikiTitleParsingException e) { exception = true; } assertTrue(exception); try { t = new Title("my#title"); assertEquals("title", t.getSectionText()); } catch(WikiTitleParsingException e) { Assume.assumeNoException(e); } try { t = new Title("mytitle_(something)"); assertEquals("mytitle", t.getEntity()); assertEquals("something", t.getDisambiguationText()); } catch(WikiTitleParsingException e) { Assume.assumeNoException(e); } try { t = new Title("fantastic mr fox"); assertEquals("fantastic mr fox", t.getEntity()); } catch(WikiTitleParsingException e) { Assume.assumeNoException(e); } } }