|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
/*
|
|
|
|
|
* Copyright 2012-2016 the original author or authors.
|
|
|
|
|
* Copyright 2012-2017 the original author or authors.
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
@ -73,6 +73,14 @@ public class GitPropertiesTests {
|
|
|
|
|
assertThat(properties.get("commit.time")).isEqualTo("2016-03-04 15:22:24");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void shortCommitUsedIfPresent() {
|
|
|
|
|
GitProperties properties = new GitProperties(
|
|
|
|
|
createProperties("master", "abcdefghijklmno", "abcdefgh", "1457527123"));
|
|
|
|
|
assertThat(properties.getCommitId()).isEqualTo("abcdefghijklmno");
|
|
|
|
|
assertThat(properties.getShortCommitId()).isEqualTo("abcdefgh");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void shortenCommitIdShorterThan7() {
|
|
|
|
|
GitProperties properties = new GitProperties(
|
|
|
|
@ -89,14 +97,6 @@ public class GitPropertiesTests {
|
|
|
|
|
assertThat(properties.getShortCommitId()).isEqualTo("abcdefg");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void shortCommitIdCustomLength() {
|
|
|
|
|
GitProperties properties = new GitProperties(
|
|
|
|
|
createProperties("master", "abcdefghijklmno", "abcdefgh", "1457527123"));
|
|
|
|
|
assertThat(properties.getCommitId()).isEqualTo("abcdefghijklmno");
|
|
|
|
|
assertThat(properties.getShortCommitId()).isEqualTo("abcdefgh");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Properties createProperties(String branch, String commitId,
|
|
|
|
|
String commitIdAbbrev, String commitTime) {
|
|
|
|
|
Properties properties = new Properties();
|
|
|
|
|