ConfigHelper { public static GitInfo readGitProperties(final String fileName) { final Properties properties = new Properties(); LOGGER.debug("Retrieving git properties from file: " + fileName); try { properties.load(GitInfo.class.getClassLoader().getResourceAsStream(fileName)); return new GitInfo(String.valueOf(properties.get("git.commit.id.abbrev")), String.valueOf(properties.get("git.build.version"))); } catch (Exception e) { LOGGER.error("Could not load git.properties", e); String propertyNotFound = "git property not found"; return new GitInfo(propertyNotFound, propertyNotFound); } } private  ConfigHelper(); static GitInfo readGitProperties(final String fileName);  }
@Test public void readGitProperties() { String gitPropertiesFile = "fixtures/git.properties"; final ConfigHelper.GitInfo gitInfo = ConfigHelper.readGitProperties(gitPropertiesFile); Assert.assertEquals("test-id-short", gitInfo.commitId); Assert.assertEquals("test-version", gitInfo.buildVersion); String failGitPropertiesFile = "fail.git.properties"; final ConfigHelper.GitInfo failGitInfo = ConfigHelper.readGitProperties(failGitPropertiesFile); Assert.assertEquals("git property not found", failGitInfo.commitId); Assert.assertEquals("git property not found", failGitInfo.buildVersion); }