Skip to content

Instantly share code, notes, and snippets.

@abbas-oveissi
Created December 11, 2018 09:51
Show Gist options
  • Save abbas-oveissi/bdd7fffd644d68a4fe45b3a7d09b1dde to your computer and use it in GitHub Desktop.
Save abbas-oveissi/bdd7fffd644d68a4fe45b3a7d09b1dde to your computer and use it in GitHub Desktop.
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals;
@RunWith(Parameterized.class)
public class MoneyParameterizedTest {
@Parameterized.Parameters
public static Collection<Object[]> getMoney() {
return Arrays.asList(new Object[][]{
{10, "USD"}, {20, "EUR"}
});
}
private int amount;
private String currency;
public MoneyParameterizedTest(int amount, String currency) {
this.amount = amount;
this.currency = currency;
}
@Test
public void constructorShouldSetAmountAndCurrency() {
Money money = new Money(amount, currency);
assertEquals(amount, money.getAmount());
assertEquals(currency, money.getCurrency());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment