SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @RunWith(Parameterized.class)
  2. public class BankAccountTestParameterized {
  3.  
  4.     private BankAccount account;
  5.     private double amount;
  6.     private boolean branch;
  7.     private double expected;
  8.  
  9.     public BankAccountTestParameterized(double amount, boolean branch, double expected) {
  10.         this.amount = amount;
  11.         this.branch = branch;
  12.         this.expected = expected;
  13.     }
  14.  
  15.     @org.junit.Before
  16.     public void setup() {
  17.         account = new BankAccount("Tim", "Buchalka", 1000.00, BankAccount.CHECKING);
  18.         System.out.println("Running a test...");
  19.     }
  20.  
  21.     @Parameterized.Parameters
  22.     public static Collection<Object[]> testConditions() {
  23.         return Arrays.asList(new Object[][] {
  24.                 {100.00, true, 1100.00},
  25.                 {200.00, true, 1200.00},
  26.                 {325.14, true, 1325.14},
  27.                 {489.33, true, 1489.33},
  28.                 {1000.00, true, 2000.00}
  29.         });
  30.     }
  31.  
  32.     @org.junit.Test
  33.     public void deposit() throws Exception {
  34.         account.deposit(amount, branch);
  35.         assertEquals(expected, account.getBalance(), .01);
  36.     }
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top