Created
April 3, 2017 20:00
-
-
Save kstefan/2617dfff0dbb1bec72eba05f69fb8dc3 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 org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.junit.runners.Parameterized; | |
import org.junit.runners.Parameterized.Parameters; | |
import java.util.Arrays; | |
import java.util.Collection; | |
import static org.junit.Assert.assertEquals; | |
@RunWith(Parameterized.class) | |
public class MaxNumberParametrizedTest { | |
private final int input1; | |
private final int input2; | |
private final int expectedResult; | |
public MaxNumberParametrizedTest(int input1, int input2, int expectedResult) { | |
this.input1 = input1; | |
this.input2 = input2; | |
this.expectedResult = expectedResult; | |
} | |
@Parameters(name = "{index}: Math.max({0}, {1}) = {2}") | |
public static Collection<Object[]> data() { | |
return Arrays.asList(new Object[][] { | |
{ 0, 0, 0}, {1, 0, 1}, {2, 5, 5}, {10, 10, 10} | |
}); | |
} | |
@Test | |
public void maximumOfTwoNumbers() { | |
assertEquals(expectedResult, Math.max(input1, input2)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment