Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.48 KB | None | 0 0
  1. /**
  2.  *
  3.  */
  4. package com.test;
  5.  
  6. import com.sourcecodebook.CashRegister;
  7.  
  8. import junit.framework.TestCase;
  9.  
  10. /**
  11.  * @author pelle
  12.  *
  13.  */
  14. public class NewJunit3Test extends TestCase {
  15.  
  16.     /**
  17.      * @param name
  18.      */
  19.     public NewJunit3Test(String name) {
  20.         super(name);
  21.     }
  22.  
  23.    
  24.        public void testSimpleCase()
  25.        {
  26.           CashRegister register = new CashRegister();
  27.           register.recordPurchase(0.75);
  28.           register.recordPurchase(1.50);
  29.           register.enterPayment(2, 0, 5, 0, 0);
  30.           double expected = 0.25;
  31.           assertEquals(expected, register.giveChange(), EPSILON);
  32. //        Assert.assertArrayEquals(expecteds, actuals);
  33. //        Assert.
  34. //        Assert.assertEquals(expected, register.giveChange(), EPSILON);
  35.        }
  36.        public void testZeroBalance()
  37.        {
  38.           CashRegister register = new CashRegister();
  39.           register.recordPurchase(2.25);
  40.           register.recordPurchase(19.25);
  41.           register.enterPayment(21, 2, 0, 0, 0);
  42.           assertEquals(0, register.giveChange(), EPSILON);
  43. //        Assert.assertEquals(0, register.giveChange(), EPSILON);
  44.        }
  45.        // More test cases
  46.        
  47.        private static final double EPSILON = 1E-12;
  48.    
  49.    
  50. //  /* (non-Javadoc)
  51. //   * @see junit.framework.TestCase#setUp()
  52. //   */
  53. //  protected void setUp() throws Exception {
  54. //      super.setUp();
  55. //  }
  56. //
  57. //  /* (non-Javadoc)
  58. //   * @see junit.framework.TestCase#tearDown()
  59. //   */
  60. //  protected void tearDown() throws Exception {
  61. //      super.tearDown();
  62. //  }
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement