Last active
August 29, 2015 14:19
-
-
Save kmdupr33/5979104560afac8b525d 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
public void testSquare() { | |
TerribleMathStudent terribleMathStudent = new TerribleMathStudent(); | |
terribleMathStudent.setCalculator(new BrokenCalculator()); | |
//terribleMathStudent uses broken calculator to do this, so this student really sucks | |
int result = terribleMathStudent.square(2); | |
assertNotEquals(result, 4); | |
//we pity the terrible math student, so we give him a working calculator | |
terribleMathStudent.setCalculator(new Calculator()); | |
result = terribleMathStudent.square(2); | |
assertEquals(result, 4); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment