com.ail.commercialtest
Class TestCurrencyAmount

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by com.ail.commercialtest.TestCurrencyAmount
All Implemented Interfaces:
junit.framework.Test

public class TestCurrencyAmount
extends junit.framework.TestCase

Version:
$Revision: 1.1 $

Constructor Summary
TestCurrencyAmount(java.lang.String name)
          Constructs a test case with the given name.
 
Method Summary
static void main(java.lang.String[] args)
          Run this testcase from the command line.
static junit.framework.Test suite()
          Create an instance of this test case as a TestSuite.
 void testAutoCreate()
          A CurrencyAmount created with the default constructor should (when its add/subtract method is called) automatically assume the currency of the CurrencyAmount passed in.
 void testCurrencyApplyRate()
           
 void testCurrencyScale()
           
 void testGoodValues()
           
 void testGreaterThan()
          Test the greaterThan method.
 void testLessThan()
          Test the lessThan method.
 
Methods inherited from class junit.framework.TestCase
countTestCases, getName, run, run, runBare, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestCurrencyAmount

public TestCurrencyAmount(java.lang.String name)
Constructs a test case with the given name.

Parameters:
name - The tests name
Method Detail

suite

public static junit.framework.Test suite()
Create an instance of this test case as a TestSuite.

Returns:
Test an instance of this test case.

main

public static void main(java.lang.String[] args)
Run this testcase from the command line.

Parameters:
args - No command line args are required.

testGoodValues

public void testGoodValues()

testCurrencyScale

public void testCurrencyScale()

testCurrencyApplyRate

public void testCurrencyApplyRate()

testAutoCreate

public void testAutoCreate()
A CurrencyAmount created with the default constructor should (when its add/subtract method is called) automatically assume the currency of the CurrencyAmount passed in.


testGreaterThan

public void testGreaterThan()
Test the greaterThan method.
  1. Create two Currency amounts (test1 & test2), set test1 to 100USD and test2 to 101USD.
  2. Fail if test2.greaterThan(test1) returns false.
  3. Fail if test1.greaterThan(test2) returns true.
  4. Repeate the previous tests using the overloaded amount, currency method.
  5. Create another CurrencyAmount (test3) for 101GBP.
  6. Fail if test1.greaterThan(test3) does anything other than throwing an IllegalArgumentException.
  7. Fail if test3.greaterThan(test1) does anything other than throwing an IllegalArgumentException.
  8. Repeate the previous test using the overloaded amount, currency method.


testLessThan

public void testLessThan()
Test the lessThan method.
  1. Create two Currency amounts (test1 & test2), set test1 to 101USD and test2 to 100USD.
  2. Fail if test2.lessThan(test1) returns false.
  3. Fail if test1.lessThan(test2) returns true.
  4. Repeate the previous tests using the overloaded amount, currency method.
  5. Create another CurrencyAmount (test3) for 100GBP.
  6. Fail if test1.lessThan(test3) does anything other than throwing an IllegalArgumentException.
  7. Fail if test3.lessThan(test1) does anything other than throwing an IllegalArgumentException.
  8. Repeate the previous test using the overloaded amount, currency method.