Testing exceptional conditions

    public void testZeroDenominator() {
      
        try {
            new Fraction(1, 0);
            fail("Allowed zero denominator");
        }
        catch (ArithmeticException success) {
            
            
        }
      
    }

Previous | Next | Top | Cafe con Leche

Copyright 2005-2007 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified October 5, 2006