@Test
    public void shouldThrowArithmeticExceptionOnOverflow() {
        for (final Triplet<Number, Number, String> q : OVERFLOW_CASES) {
            try {
                switch (q.getValue2()) {
                    case "add":
                        add(q.getValue0(), q.getValue1());
                        break;
                    case "sub":
                        sub(q.getValue0(), q.getValue1());
                        break;
                    case "mul":
                        mul(q.getValue0(), q.getValue1());
                        break;
                    case "div":
                        div(q.getValue0(), q.getValue1());
                        break;
                    default:
                        fail("Unexpected math operation " + q.getValue2() + "'");
                }
                fail("ArithmeticException expected");
            }
            catch (ArithmeticException ex) {
                // expected
            }
        }
    }
@author Daniel Kuppitz (http://gremlin.guru)
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/NumberHelperTest.java