Created
January 29, 2016 21:10
-
-
Save thiagotn/07b1996b38d743896201 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 static org.junit.Assert.*; | |
import java.util.Arrays; | |
import org.junit.Before; | |
import org.junit.Test; | |
import dev.util.inscriptions.Calculator; | |
public class CalculatorTest { | |
private Calculator calculator; | |
@Before | |
public void setUp() throws Exception { | |
calculator = new Calculator(); | |
} | |
@Test(expected = IllegalArgumentException.class) | |
public void testCalcInvalidParams() throws Exception { | |
calculator.calcWithArray(Arrays.asList("1", "+")); | |
} | |
@Test(expected = IllegalArgumentException.class) | |
public void testCalcInvalidParams2() throws Exception { | |
calculator.calcWithArray(Arrays.asList("1")); | |
} | |
@Test(expected = IllegalArgumentException.class) | |
public void testCalcInvalidParams3() throws Exception { | |
calculator.calcWithArray(Arrays.asList("/")); | |
} | |
@Test | |
public void testCalcSum() throws Exception { | |
Double expected = 1000D; | |
Double actual = calculator.calcWithArray(Arrays.asList("1", "+", "999")); | |
assertEquals(expected, actual); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment