### Question:
PropertyUtils { public static String stringProperty(Configuration conf, Property property) { return conf.get(property.key(), (String) property.defaultValue()); } private  PropertyUtils(); static String stringProperty(Configuration conf, Property property); static boolean booleanProperty(Configuration conf, Property property); static int intProperty(Configuration conf, Property property); static long longProperty(Configuration conf, Property property);  }### Answer:
@Test public void stringPropertyReturnsConfValue() { when(property.key()).thenReturn(STRING_PROPERTY); when(property.defaultValue()).thenReturn("default"); assertThat(stringProperty(conf, property)).isEqualTo("string"); }
@Test public void stringPropertyReturnsDefaultValue() { when(property.key()).thenReturn("unset"); when(property.defaultValue()).thenReturn("default"); assertThat(stringProperty(conf, property)).isEqualTo("default"); }
@Test public void stringPropertyReturnsNull() { when(property.key()).thenReturn("unset"); assertThat(stringProperty(conf, property)).isNull(); }