### Question:
IdentityUtil { public static String getProperty(String key) { if (props == null) { try { loadPropertiesFromClasspath(); } catch (Exception ex) { LOG.warn("Unable to load properties file."); return null; } } return props.getProperty(key); }  static String getProperty(String key); static String getProperty(String key, String defaultValue); static int getIntProperty(String key);  }### Answer:
@Test public void shouldGetProperty() throws IOException { PowerMockito.mockStatic(IdentityUtil.class); PowerMockito.when(IdentityUtil.class.getResourceAsStream( "/identity.properties")).thenReturn(streamMock); PowerMockito.when(IdentityUtil.getProperty("key")).thenReturn("value"); Assert.assertEquals("value", IdentityUtil.getProperty("key")); }
@Test public void shouldGetPropertyWithDefaultValue() throws IOException { PowerMockito.mockStatic(IdentityUtil.class); PowerMockito.when(IdentityUtil.class.getResourceAsStream( "/identity.properties")).thenReturn(streamMock); PowerMockito.when(IdentityUtil.getProperty("key", "default")).thenReturn("default"); Assert.assertEquals("default", IdentityUtil.getProperty("key", "default")); }