Ejemplo n.º 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());
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 4
0
 @Test(expected = IndexOutOfBoundsException.class)
 public void testGetWord_Overflow() {
   loremIpsum.getWord(loremIpsum.getNumWords());
 }
Ejemplo n.º 5
0
 /** Test method for {@link com.dell.mensa.util.LoremIpsum#getNumWords()}. */
 @Test
 public void testGetNumWords() {
   Assert.assertEquals(EXPECTED_WORDS.length, loremIpsum.getNumWords());
 }