Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- */
- package com.test;
- import com.sourcecodebook.CashRegister;
- import junit.framework.TestCase;
- /**
- * @author pelle
- *
- */
- public class NewJunit3Test extends TestCase {
- /**
- * @param name
- */
- public NewJunit3Test(String name) {
- super(name);
- }
- public void testSimpleCase()
- {
- CashRegister register = new CashRegister();
- register.recordPurchase(0.75);
- register.recordPurchase(1.50);
- register.enterPayment(2, 0, 5, 0, 0);
- double expected = 0.25;
- assertEquals(expected, register.giveChange(), EPSILON);
- // Assert.assertArrayEquals(expecteds, actuals);
- // Assert.
- // Assert.assertEquals(expected, register.giveChange(), EPSILON);
- }
- public void testZeroBalance()
- {
- CashRegister register = new CashRegister();
- register.recordPurchase(2.25);
- register.recordPurchase(19.25);
- register.enterPayment(21, 2, 0, 0, 0);
- assertEquals(0, register.giveChange(), EPSILON);
- // Assert.assertEquals(0, register.giveChange(), EPSILON);
- }
- // More test cases
- private static final double EPSILON = 1E-12;
- // /* (non-Javadoc)
- // * @see junit.framework.TestCase#setUp()
- // */
- // protected void setUp() throws Exception {
- // super.setUp();
- // }
- //
- // /* (non-Javadoc)
- // * @see junit.framework.TestCase#tearDown()
- // */
- // protected void tearDown() throws Exception {
- // super.tearDown();
- // }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement