| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- import org.junit.Before;
- import org.junit.Test;
- import org.junit.Ignore;
-
- import static org.junit.Assert.assertEquals;
-
- public class FoodChainTest {
- private FoodChain foodChain;
-
- @Before
- public void setup() {
- foodChain = new FoodChain();
- }
-
- @Test
- public void fly() {
- int verse = 1;
- String expected = "I know an old lady who swallowed a fly.\n" +
- "I don't know why she swallowed the fly. Perhaps she'll die.";
-
- assertEquals(expected, foodChain.verse(verse));
- }
-
- @Test
- @Ignore("Remove to run test.")
- public void spider() {
- int verse = 2;
- String expected = "I know an old lady who swallowed a spider.\n" +
- "It wriggled and jiggled and tickled inside her.\n" +
- "She swallowed the spider to catch the fly.\n" +
- "I don't know why she swallowed the fly. Perhaps she'll die.";
-
- assertEquals(expected, foodChain.verse(verse));
- }
-
- @Test
- @Ignore("Remove to run test.")
- public void bird() {
- int verse = 3;
- String expected = "I know an old lady who swallowed a bird.\n" +
- "How absurd to swallow a bird!\n" +
- "She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
- "She swallowed the spider to catch the fly.\n" +
- "I don't know why she swallowed the fly. Perhaps she'll die.";
-
- assertEquals(expected, foodChain.verse(verse));
- }
-
- @Test
- @Ignore("Remove to run test.")
- public void cat() {
- int verse = 4;
- String expected = "I know an old lady who swallowed a cat.\n" +
- "Imagine that, to swallow a cat!\n" +
- "She swallowed the cat to catch the bird.\n" +
- "She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
- "She swallowed the spider to catch the fly.\n" +
- "I don't know why she swallowed the fly. Perhaps she'll die.";
-
- assertEquals(expected, foodChain.verse(verse));
- }
-
-
- @Test
- @Ignore("Remove to run test.")
- public void dog() {
- int verse = 5;
- String expected = "I know an old lady who swallowed a dog.\n" +
- "What a hog, to swallow a dog!\n" +
- "She swallowed the dog to catch the cat.\n" +
- "She swallowed the cat to catch the bird.\n" +
- "She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
- "She swallowed the spider to catch the fly.\n" +
- "I don't know why she swallowed the fly. Perhaps she'll die.";
-
- assertEquals(expected, foodChain.verse(verse));
- }
-
- @Test
- @Ignore("Remove to run test.")
- public void goat() {
- int verse = 6;
- String expected = "I know an old lady who swallowed a goat.\n" +
- "Just opened her throat and swallowed a goat!\n" +
- "She swallowed the goat to catch the dog.\n" +
- "She swallowed the dog to catch the cat.\n" +
- "She swallowed the cat to catch the bird.\n" +
- "She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
- "She swallowed the spider to catch the fly.\n" +
- "I don't know why she swallowed the fly. Perhaps she'll die.";
-
- assertEquals(expected, foodChain.verse(verse));
- }
-
- @Test
- @Ignore("Remove to run test.")
- public void cow() {
- int verse = 7;
- String expected = "I know an old lady who swallowed a cow.\n" +
- "I don't know how she swallowed a cow!\n" +
- "She swallowed the cow to catch the goat.\n" +
- "She swallowed the goat to catch the dog.\n" +
- "She swallowed the dog to catch the cat.\n" +
- "She swallowed the cat to catch the bird.\n" +
- "She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
- "She swallowed the spider to catch the fly.\n" +
- "I don't know why she swallowed the fly. Perhaps she'll die.";
-
- assertEquals(expected, foodChain.verse(verse));
- }
-
- @Test
- @Ignore("Remove to run test.")
- public void horse() {
- int verse = 8;
- String expected = "I know an old lady who swallowed a horse.\n" +
- "She's dead, of course!";
-
- assertEquals(expected, foodChain.verse(verse));
- }
-
-
- @Test
- @Ignore("Remove to run test.")
- public void multipleVerses() {
- int startVerse = 1;
- int endVerse = 3;
- String expected = "I know an old lady who swallowed a fly.\n" +
- "I don't know why she swallowed the fly. Perhaps she'll die.\n" +
- "\n" +
- "I know an old lady who swallowed a spider.\n" +
- "It wriggled and jiggled and tickled inside her.\n" +
- "She swallowed the spider to catch the fly.\n" +
- "I don't know why she swallowed the fly. Perhaps she'll die.\n" +
- "\n" +
- "I know an old lady who swallowed a bird.\n" +
- "How absurd to swallow a bird!\n" +
- "She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
- "She swallowed the spider to catch the fly.\n" +
- "I don't know why she swallowed the fly. Perhaps she'll die.";
-
- assertEquals(expected, foodChain.verses(startVerse, endVerse));
- }
-
-
- @Test
- @Ignore("Remove to run test.")
- public void wholeSong() {
- int startVerse = 1;
- int endVerse = 8;
- String expected = "I know an old lady who swallowed a fly.\n" +
- "I don't know why she swallowed the fly. Perhaps she'll die.\n" +
- "\n" +
- "I know an old lady who swallowed a spider.\n" +
- "It wriggled and jiggled and tickled inside her.\n" +
- "She swallowed the spider to catch the fly.\n" +
- "I don't know why she swallowed the fly. Perhaps she'll die.\n" +
- "\n" +
- "I know an old lady who swallowed a bird.\n" +
- "How absurd to swallow a bird!\n" +
- "She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
- "She swallowed the spider to catch the fly.\n" +
- "I don't know why she swallowed the fly. Perhaps she'll die.\n" +
- "\n" +
- "I know an old lady who swallowed a cat.\n" +
- "Imagine that, to swallow a cat!\n" +
- "She swallowed the cat to catch the bird.\n" +
- "She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
- "She swallowed the spider to catch the fly.\n" +
- "I don't know why she swallowed the fly. Perhaps she'll die.\n" +
- "\n" +
- "I know an old lady who swallowed a dog.\n" +
- "What a hog, to swallow a dog!\n" +
- "She swallowed the dog to catch the cat.\n" +
- "She swallowed the cat to catch the bird.\n" +
- "She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
- "She swallowed the spider to catch the fly.\n" +
- "I don't know why she swallowed the fly. Perhaps she'll die.\n" +
- "\n" +
- "I know an old lady who swallowed a goat.\n" +
- "Just opened her throat and swallowed a goat!\n" +
- "She swallowed the goat to catch the dog.\n" +
- "She swallowed the dog to catch the cat.\n" +
- "She swallowed the cat to catch the bird.\n" +
- "She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
- "She swallowed the spider to catch the fly.\n" +
- "I don't know why she swallowed the fly. Perhaps she'll die.\n" +
- "\n" +
- "I know an old lady who swallowed a cow.\n" +
- "I don't know how she swallowed a cow!\n" +
- "She swallowed the cow to catch the goat.\n" +
- "She swallowed the goat to catch the dog.\n" +
- "She swallowed the dog to catch the cat.\n" +
- "She swallowed the cat to catch the bird.\n" +
- "She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
- "She swallowed the spider to catch the fly.\n" +
- "I don't know why she swallowed the fly. Perhaps she'll die.\n" +
- "\n" +
- "I know an old lady who swallowed a horse.\n" +
- "She's dead, of course!";
-
- assertEquals(expected, foodChain.verses(startVerse, endVerse));
- }
- }
|