f = Fraction.getFraction(-1, 0, Integer.MAX_VALUE); assertEquals(-Integer.MAX_VALUE, f.getNumerator()); assertEquals(Integer.MAX_VALUE, f.getDenominator());  try {  f = Fraction.getFraction(0, 4, Integer.MIN_VALUE); fail("expecting ArithmeticException"); } catch (ArithmeticException ex) {} try { f = Fraction.getFraction(1, 1, Integer.MAX_VALUE); fail("expecting ArithmeticException"); } catch (ArithmeticException ex) {} try { f = Fraction.getFraction(-1, 2, Integer.MAX_VALUE); fail("expecting ArithmeticException"); } catch (ArithmeticException ex) {}
    public void testFactory_int_int_int() {        Fraction f = null;                // zero        f = Fraction.getFraction(0, 0, 2);        assertEquals(0, f.getNumerator());        assertEquals(2, f.getDenominator());                f = Fraction.getFraction(2, 0, 2);        assertEquals(4, f.getNumerator());        assertEquals(2, f.getDenominator());                f = Fraction.getFraction(0, 1, 2);        assertEquals(1, f.getNumerator());        assertEquals(2, f.getDenominator());                // normal        f = Fraction.getFraction(1, 1, 2);        assertEquals(3, f.getNumerator());        assertEquals(2, f.getDenominator());                // negatives        try {            f = Fraction.getFraction(1, -6, -10);            fail("expecting ArithmeticException");        } catch (ArithmeticException ex) {}        try {            f = Fraction.getFraction(1, -6, -10);            fail("expecting ArithmeticException");        } catch (ArithmeticException ex) {}        try {            f = Fraction.getFraction(1, -6, -10);            fail("expecting ArithmeticException");        } catch (ArithmeticException ex) {}                // negative whole        f = Fraction.getFraction(-1, 6, 10);        assertEquals(-16, f.getNumerator());        assertEquals(10, f.getDenominator());                try {            f = Fraction.getFraction(-1, -6, 10);            fail("expecting ArithmeticException");        } catch (ArithmeticException ex) {}        try {            f = Fraction.getFraction(-1, 6, -10);            fail("expecting ArithmeticException");        } catch (ArithmeticException ex) {}                try {            f = Fraction.getFraction(-1, -6, -10);            fail("expecting ArithmeticException");        } catch (ArithmeticException ex) {}                // zero denominator        try {            f = Fraction.getFraction(0, 1, 0);            fail("expecting ArithmeticException");        } catch (ArithmeticException ex) {}                try {            f = Fraction.getFraction(1, 2, 0);            fail("expecting ArithmeticException");        } catch (ArithmeticException ex) {}                try {            f = Fraction.getFraction(-1, -3, 0);            fail("expecting ArithmeticException");        } catch (ArithmeticException ex) {}                try {            f = Fraction.getFraction(Integer.MAX_VALUE, 1, 2);             fail("expecting ArithmeticException");        } catch (ArithmeticException ex) {}                try {            f = Fraction.getFraction(-Integer.MAX_VALUE, 1, 2);            fail("expecting ArithmeticException");        } catch (ArithmeticException ex) {}    }