@Test public void testGetLongThrowsNullPointerException1() throws Throwable { SubConfiguration subConfiguration = new SubConfiguration(); try { subConfiguration.getLong("testSubConfigurationPropertyName"); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull("ex.getMessage()", ex.getMessage()); assertNull("subConfiguration.cfg", subConfiguration.cfg); } }
@Test public void testGetLongThrowsNullPointerException() throws Throwable { Configuration cfg = new SubConfiguration(); SubConfiguration subConfiguration = new SubConfiguration(cfg, "testSubConfigurationPrefix"); try { subConfiguration.getLong("testSubConfigurationPropertyName", 100L); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull("ex.getMessage()", ex.getMessage()); assertSame("subConfiguration.cfg", cfg, subConfiguration.cfg); } }
@Test public void testGetLong() throws Throwable { Configuration cfg = new SimpleConfiguration(); SubConfiguration subConfiguration = new SubConfiguration(cfg, "testSubConfigurationPrefix"); long result = subConfiguration.getLong("testSubConfigurationPropertyName", 100L); assertEquals("result", 100L, result); assertSame("subConfiguration.cfg", cfg, subConfiguration.cfg); }
@Test public void testGetLong2() throws Throwable { Configuration cfg = new SimpleConfiguration(); SubConfiguration subConfiguration = new SubConfiguration(cfg, "testSubConfigurationPrefix"); long result = subConfiguration.getLong("testSubConfigurationPropertyName"); assertEquals("result", 0L, result); assertSame("subConfiguration.cfg", cfg, subConfiguration.cfg); }
@Test public void testGetLong1() throws Throwable { Configuration cfg = new SimpleConfiguration(); SubConfiguration subConfiguration = new SubConfiguration(cfg, "testSubConfigurationPrefix"); long result = subConfiguration.getLong("testSubConfigurationPropertyName", 0L); assertEquals("result", 0L, result); assertSame("subConfiguration.cfg", cfg, subConfiguration.cfg); }
@Test public void testGetLongThrowsNumberFormatException() throws Throwable { Configuration cfg = new SimpleConfiguration(); SubConfiguration subConfiguration = new SubConfiguration(cfg, "testSubConfigurationPrefix"); subConfiguration.put("testString", "false"); try { subConfiguration.getLong("testString", 100L); fail("Expected NumberFormatException to be thrown"); } catch (NumberFormatException ex) { assertEquals("ex.getMessage()", "For input string: \"false\"", ex.getMessage()); assertSame("subConfiguration.cfg", cfg, subConfiguration.cfg); } }
@Test public void testGetLongThrowsNumberFormatException1() throws Throwable { SubConfiguration cfg = new SubConfiguration(); SubConfiguration subConfiguration = new SubConfiguration(cfg, "testSubConfigurationPrefix"); cfg.setConfiguration(new SimpleConfiguration()); subConfiguration.put("testString", ""); try { subConfiguration.getLong("testString"); fail("Expected NumberFormatException to be thrown"); } catch (NumberFormatException ex) { assertEquals("ex.getMessage()", "For input string: \"\"", ex.getMessage()); assertSame("subConfiguration.cfg", cfg, subConfiguration.cfg); } }