Created
September 16, 2020 19:22
-
-
Save leoforney/2e5bc120af4e2fc75b1abc4acde1d760 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import balloon3.Balloon; | |
import org.junit.Test; | |
import static org.junit.Assert.*; | |
/* | |
B1 - Max blow failed, initial isn't 0, blows while popped | |
B2 - Blows while balloon is popped | |
B3 - Correct version | |
B4 - Deflate causes balloon to pop | |
*/ | |
public class BalloonsTest { | |
@Test | |
public void testInitial() { | |
Balloon balloon = new Balloon(10); | |
assertEquals(0, balloon.getRadius()); | |
} | |
@Test | |
public void testPopped() { | |
Balloon balloon = new Balloon(10); | |
assertFalse(balloon.isPopped()); | |
} | |
@Test | |
public void testBlow() { | |
Balloon balloon = new Balloon(10); | |
balloon.blow(5); | |
assertEquals(5, balloon.getRadius()); | |
} | |
@Test | |
public void testDeflateRadius() { | |
Balloon balloon = new Balloon(10); | |
balloon.blow(5); | |
balloon.deflate(); | |
assertEquals(0, balloon.getRadius()); | |
} | |
@Test | |
public void testMaxBlow() { | |
Balloon balloon = new Balloon(10); | |
balloon.blow(15); | |
assertTrue(balloon.isPopped()); | |
} | |
@Test | |
public void testDeflatePopped() { | |
Balloon balloon = new Balloon(10); | |
balloon.blow(5); | |
balloon.deflate(); | |
assertFalse(balloon.isPopped()); | |
} | |
@Test | |
public void testBlowWhilePopped() { | |
Balloon balloon = new Balloon(10); | |
balloon.pop(); | |
balloon.blow(5); | |
assertEquals(0, balloon.getRadius()); | |
} | |
@Test | |
public void testBlowMultiple() { | |
Balloon balloon = new Balloon(10); | |
balloon.blow(3); | |
balloon.blow(3); | |
assertEquals(6, balloon.getRadius()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment