}
@Test
- public void hashMustMatch() {
+ public void hashMustExist() {
InputStream stream = jpf.getClass().getResourceAsStream(".version");
- assertEquals("Should have the same hash", fetchCurrentRevisionFromVCS().trim(), readContentFrom(stream).trim());
- }
-
- private String fetchCurrentRevisionFromVCS() {
- String currentRevision = "";
- try {
- Process process = Runtime.getRuntime().exec("git rev-parse HEAD");
- process.waitFor();
- InputStream output = process.getInputStream();
- currentRevision = readContentFrom(output);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- return currentRevision;
+ assertTrue(".version file should be non-empty", !readContentFrom(stream).trim().isEmpty());
}
private String readContentFrom(InputStream stream) {