// ========================================================================= // Internal methods // ========================================================================= private static void sanityCheckDefaultText(final LoremIpsum loremIpsum_) { // Sanity check using hard-coded knowledge of default resource... Assert.assertEquals("Lorem", loremIpsum_.getWord(0)); Assert.assertEquals("Ipsum", loremIpsum_.getWord(1)); Assert.assertEquals("laborum.", loremIpsum_.getWord(loremIpsum_.getNumWords() - 1)); Assert.assertEquals(6, loremIpsum_.getNumParagraphs()); }
@Test public void testLoremCtorString_Null() throws IOException { loremIpsum = new LoremIpsum(null); Assert.assertNull(loremIpsum.getText()); Assert.assertEquals(0, loremIpsum.getNumParagraphs()); Assert.assertEquals(0, loremIpsum.getNumSentences()); Assert.assertEquals(0, loremIpsum.getNumWords()); }
/** * Test method for {@link com.dell.mensa.util.LoremIpsum#LoremIpsum(java.lang.String)}. * * @throws IOException if thrown by code under test */ @Test public void testLoremCtorString() throws IOException { final String text = "hi"; loremIpsum = new LoremIpsum(text); Assert.assertEquals(text, loremIpsum.getText()); Assert.assertEquals(1, loremIpsum.getNumParagraphs()); Assert.assertEquals(1, loremIpsum.getNumSentences()); Assert.assertEquals(1, loremIpsum.getNumWords()); }
/** Test method for {@link com.dell.mensa.util.LoremIpsum#getNumParagraphs()}. */ @Test public void testGetNumParagraphs() { Assert.assertEquals(EXPECTED_PARAGRAPHS.length, loremIpsum.getNumParagraphs()); }
@Test(expected = IndexOutOfBoundsException.class) public void testGetParagraph_Overflow() { loremIpsum.getParagraph(loremIpsum.getNumParagraphs()); }