MigrationProperties extends Properties { public boolean getBoolean(String property, boolean defaultValue) { String prop = getStringOrNull(property); if (prop == null) return defaultValue; return Boolean.valueOf(prop); } 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 testGetBooleanMissing() { assertFalse(sut.getBoolean(MISSING_PROPERTY, false)); assertTrue(sut.getBoolean(MISSING_PROPERTY, true)); }
@Test public void testGetBooleanValid() { assertEquals(VALID_BOOLEAN_VALUE, sut.getBoolean(VALID_BOOLEAN, false)); assertEquals(VALID_BOOLEAN_VALUE, sut.getBoolean(VALID_BOOLEAN, true)); }
@Test public void testGetBooleanNeedsTrimmed() { assertEquals(VALID_BOOLEAN_VALUE, sut.getBoolean(NEEDS_TRIMMED_BOOLEAN, false)); assertEquals(VALID_BOOLEAN_VALUE, sut.getBoolean(NEEDS_TRIMMED_BOOLEAN, true)); }