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