Skip to content

Instantly share code, notes, and snippets.

@mmichaelis
Created November 10, 2011 22:50
Show Gist options
  • Save mmichaelis/1356520 to your computer and use it in GitHub Desktop.
Save mmichaelis/1356520 to your computer and use it in GitHub Desktop.
Coding Kata: Roman Numerals DDT JUnit Test
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.List;
import static java.util.Arrays.asList;
import static org.junit.Assert.assertEquals;
@RunWith(Parameterized.class)
public class RomanNumberTest {
private final int number;
private final String expected;
public RomanNumberTest(final int number, final String expected) {
this.number = number;
this.expected = expected;
}
@Test
public void testGetRoman() throws Exception {
final RomanNumber roman = new RomanNumber(number);
assertEquals(expected, roman.getRoman());
}
@Parameterized.Parameters
public static List<Object[]> data() {
final Object[][] objects = {
{1, "I"},
{3, "III"},
{4, "IV"},
{5, "V"},
{6, "VI"},
{8, "VIII"},
{9, "IX"},
{10, "X"},
{11, "XI"},
{14, "XIV"},
};
return asList(objects);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment