Example #1
0
 // =========================================================================
 // 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());
 }
Example #2
0
 @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());
 }
Example #3
0
 /**
  * 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());
 }
Example #4
0
 /** Test method for {@link com.dell.mensa.util.LoremIpsum#getNumParagraphs()}. */
 @Test
 public void testGetNumParagraphs() {
   Assert.assertEquals(EXPECTED_PARAGRAPHS.length, loremIpsum.getNumParagraphs());
 }
Example #5
0
 @Test(expected = IndexOutOfBoundsException.class)
 public void testGetParagraph_Overflow() {
   loremIpsum.getParagraph(loremIpsum.getNumParagraphs());
 }