### Question:
PropertyUtils { public static int intProperty(Configuration conf, Property property) { return conf.getInt(property.key(), (int) 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 intPropertyReturnsConfValue() { when(property.key()).thenReturn(INT_PROPERTY); when(property.defaultValue()).thenReturn(100); assertThat(intProperty(conf, property)).isEqualTo(1024); }
@Test public void intPropertyReturnsDefaultValue() { when(property.key()).thenReturn("unset"); when(property.defaultValue()).thenReturn(100); assertThat(intProperty(conf, property)).isEqualTo(100); }
@Test(expected = NullPointerException.class) public void intPropertyThrowsNullPointerException() { when(property.key()).thenReturn("unset"); intProperty(conf, property); }