Created
November 3, 2020 09:38
-
-
Save sachi-d/88c9dfbcbc0d5ad75d5eb8359893d8ad 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
@RunWith(Parameterized.class) | |
public class AdderTest extends TestCase { | |
@Parameterized.Parameters(name = "{index}: add[{0}, {1}]={2}") | |
public static Iterable<Object[]> data() { | |
return Arrays.asList(new Object[][]{ | |
{0, 0, 0}, | |
{1, 1, 2}, | |
{2, 1, 3}, | |
{100, 400, 500}, | |
{99, 1, 100} | |
}); | |
} | |
int input1; | |
int input2; | |
int expectedOutput; | |
public AdderTest(int i1, int i2, int expected) { | |
input1 = i1; | |
input2 = i2; | |
expectedOutput = expected; | |
} | |
@Test | |
public void testAdd() { | |
assertEquals(expectedOutput, Computer.add(input1, input2)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment