Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@Parameters(name = "{index}: CalculatorTest({0})={1}, throws {2}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{
{"1 + 1", 2, null},
{"1 + 1 + 1", 3, null},
{"1–1", 0, null},
{"1 * 1", 1, null},
{"1 / 1", 1, null},
{"( 1 + 1 )", 2, null},
{"+", 0, new CalculatorException("Invalid expression: +")},
{"1 1", 0, new CalculatorException("Invalid expression: 1 1")},
{"1 / 1 * 1 ", 1, null},
{"( 1–1 )", 0, null},
{"( 1 + 1–1 * 1 / 1 )", 1, null},
{"( 1 + 1 * 1 )", 2, null},
{"1 ( 1", 0, new CalculatorException("Invalid expression: 1 ( 1")},
{"1 + + 1", 0, new CalculatorException("Invalid expression: 1 + + 1")}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.