Created
December 11, 2018 09:51
-
-
Save abbas-oveissi/bdd7fffd644d68a4fe45b3a7d09b1dde to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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