MigrationProperties extends Properties { public long getRequiredLong(String property) { String prop = getRequiredString(property); try { return Long.parseLong(prop); } catch (NumberFormatException e) { throw new IllegalArgumentException("Property " + property + " expected type: long"); } } MigrationProperties(String filePath); String getStringOrNull(String property); String getRequiredString(String property); int getRequiredInt(String property); long getRequiredLong(String property); boolean getBoolean(String property, boolean defaultValue);  }
@Test public void testGetRequiredLongValid() { assertEquals(VALID_LONG_VALUE, sut.getRequiredLong(VALID_LONG)); }
@Test public void testGetRequiredLongNeedsTrimmed() { assertEquals(VALID_LONG_VALUE, sut.getRequiredLong(NEEDS_TRIMMED_LONG)); }
@Test public void testGetRequiredLongMissing() { exception.expect(IllegalArgumentException.class); sut.getRequiredLong(MISSING_PROPERTY); }
@Test public void testGetRequiredLongEmpty() { exception.expect(IllegalArgumentException.class); sut.getRequiredLong(EMPTY_PROPERTY); }
@Test public void testGetRequiredLongSpaces() { exception.expect(IllegalArgumentException.class); sut.getRequiredLong(SPACES_PROPERTY); }