Skip to content

Instantly share code, notes, and snippets.

@jstrassburg
Created April 8, 2014 16:22
Show Gist options
  • Save jstrassburg/10150992 to your computer and use it in GitHub Desktop.
Save jstrassburg/10150992 to your computer and use it in GitHub Desktop.
package com.whatever;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(value = Parameterized.class)
public class MyTest {
private String _myParameter;
public MyTest(String myParameter) {
this._myParameter = myParameter;
}
@Parameterized.Parameters
public static Collection<Object[]> data() {
Object[][] data = new Object[][] {
{ "value1" }, { "value2" }
};
return Arrays.asList(data);
}
@Test
public void testSomething() throws Exception {
String expected = "a value";
String actual = doSomething(_myParameter);
Assert.assertEquals(expected, actual);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment