@Test public void testGetDouble2() throws Throwable { double result = new SimpleConfiguration(new Properties()).getDouble("testSimpleConfigurationName", 100.0); assertEquals("result", 100.0, result, 1.0E-6); }
@Test public void testGetDouble1() throws Throwable { double result = new SimpleConfiguration(new Properties()).getDouble("testSimpleConfigurationName", 0.0); assertEquals("result", 0.0, result, 1.0E-6); }
@Test public void testGetDouble() throws Throwable { double result = new SimpleConfiguration(new Properties()).getDouble("testSimpleConfigurationName"); assertEquals("result", 0.0, result, 1.0E-6); }
@Test public void testGetDoubleThrowsNumberFormatException() throws Throwable { Properties props = new Properties(); props.put("X%:?6IB(BA", "testString"); try { new SimpleConfiguration(props).getDouble("X%:?6IB(BA"); fail("Expected NumberFormatException to be thrown"); } catch (NumberFormatException ex) { assertEquals("ex.getMessage()", "For input string: \"testString\"", ex.getMessage()); } }
@Test public void testGetDoubleThrowsNumberFormatException1() throws Throwable { SimpleConfiguration simpleConfiguration = new SimpleConfiguration(new Properties()); simpleConfiguration.put("testString", ""); try { simpleConfiguration.getDouble("testString", 100.0); fail("Expected NumberFormatException to be thrown"); } catch (NumberFormatException ex) { assertEquals("ex.getMessage()", "empty String", ex.getMessage()); } }
@Test public void testGetDoubleThrowsNullPointerException1() throws Throwable { try { new SimpleConfiguration((Properties) null).getDouble("testSimpleConfigurationName", 100.0); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull("ex.getMessage()", ex.getMessage()); } }
@Test public void testGetDoubleThrowsNullPointerException() throws Throwable { try { new SimpleConfiguration((Properties) null).getDouble("testSimpleConfigurationName"); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull("ex.getMessage()", ex.getMessage()); } }