Commit id plugin (#606)
* initial * working * added injection test * [COMMIT-ID-PLUGIN] Add default value for testcheck * pivovarit review refactor * pivovarit review refactor
This commit is contained in:
parent
2fb54f3aeb
commit
d7551dd761
|
@ -7,31 +7,32 @@ import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@ContextConfiguration(classes = CommitIdApplication.class)
|
@ContextConfiguration(classes = CommitIdApplication.class)
|
||||||
public class CommitIdTest {
|
public class CommitIdTest {
|
||||||
|
|
||||||
@Value("${git.commit.message.short}")
|
private static final String UNKNOWN_STATUS = "UNKNOWN";
|
||||||
|
|
||||||
|
@Value("${git.commit.message.short:#{'UNKNOWN'}}")
|
||||||
private String commitMessage;
|
private String commitMessage;
|
||||||
|
|
||||||
@Value("${git.branch}")
|
@Value("${git.branch:#{'UNKNOWN'}")
|
||||||
private String branch;
|
private String branch;
|
||||||
|
|
||||||
@Value("${git.commit.id}")
|
@Value("${git.commit.id:#{'UNKNOWN'}")
|
||||||
private String commitId;
|
private String commitId;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldInjectGitInfoProperties() throws Exception {
|
public void shouldInjectGitInfoProperties() throws Exception {
|
||||||
|
|
||||||
assertThat(commitMessage)
|
assertThat(commitMessage)
|
||||||
.isNotNull()
|
.isNotEqualTo(UNKNOWN_STATUS);
|
||||||
.isNotEqualTo("${git.commit.message.short}");
|
|
||||||
|
|
||||||
assertThat(branch)
|
assertThat(branch)
|
||||||
.isNotNull()
|
.isNotEqualTo(UNKNOWN_STATUS);
|
||||||
.isNotEqualTo("${git.branch}");
|
|
||||||
|
|
||||||
assertThat(commitId)
|
assertThat(commitId)
|
||||||
.isNotNull()
|
.isNotEqualTo(UNKNOWN_STATUS);
|
||||||
.isNotEqualTo("${git.commit.id}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue