elvyssoares

Untitled

Oct 11th, 2021 (edited)
1,052
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.43 KB | None | 0 0
  1. import org.junit.*;
  2. import static org.junit.Assert.*;
  3.  
  4. public class BankAccountTest {
  5.  
  6.   @Test
  7.   public void test0() throws Throwable  {
  8.       BankAccount bankAccount0 = new BankAccount("Insufficient balance");
  9.       bankAccount0.deposit((-322));
  10.       bankAccount0.withdraw((-344));
  11.       int int0 = bankAccount0.withdraw(22);
  12.       assertEquals(0, bankAccount0.getBalance());
  13.       assertEquals(0, int0);
  14.   }
  15.  
  16.   @Test
  17.   public void test1() throws Throwable  {
  18.       BankAccount bankAccount0 = new BankAccount("Insufficient balance");
  19.       bankAccount0.withdraw((-344));
  20.       int int0 = bankAccount0.getBalance();
  21.       assertEquals(344, int0);
  22.   }
  23.  
  24.   @Test
  25.   public void test2() throws Throwable  {
  26.       BankAccount bankAccount0 = new BankAccount(" Q1r/9<Jy;PoFP7T");
  27.       try {
  28.         bankAccount0.withdraw(486);
  29.         fail("Expecting exception: Exception");      
  30.       } catch(Exception e) {
  31.          //
  32.          // Insufficient balance
  33.          //
  34.       }
  35.   }
  36.  
  37.   @Test
  38.   public void test3() throws Throwable  {
  39.       BankAccount bankAccount0 = new BankAccount(" Q1r/9<Jy;PoFP7T");
  40.       bankAccount0.deposit((-1047));
  41.       int int0 = bankAccount0.getBalance();
  42.       assertEquals((-1047), int0);
  43.   }
  44.  
  45.   @Test
  46.   public void test4() throws Throwable  {
  47.       BankAccount bankAccount0 = new BankAccount("@9QWjl#QRUE");
  48.       int int0 = bankAccount0.getBalance();
  49.       assertEquals(0, int0);
  50.   }
  51. }
  52.  
Advertisement
Add Comment
Please, Sign In to add comment