Author: sebb Date: Wed Mar 27 16:09:55 2013 New Revision: 1461685 URL: http://svn.apache.org/r1461685 Log: Factor out number failure tests
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java?rev=1461685&r1=1461684&r2=1461685&view=diff ============================================================================== --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java (original) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java Wed Mar 27 16:09:55 2013 @@ -231,14 +231,12 @@ public class NumberUtilsTest { final Number bigNum = NumberUtils.createNumber("-1.1E-700F"); assertNotNull(bigNum); assertEquals(BigDecimal.class, bigNum.getClass()); + } - // Check that the code fails to create a valid number when preceeded by -- rather than - - try { - NumberUtils.createNumber("--1.1E-700F"); - fail("Expected NumberFormatException"); - } catch (final NumberFormatException nfe) { - // expected - } + @Test(expected=NumberFormatException.class) + // Check that the code fails to create a valid number when preceeded by -- rather than - + public void testCreateNumberFailure_1() { + NumberUtils.createNumber("--1.1E-700F"); } // Tests to show when magnitude causes switch to next Number type