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 static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = CommitIdApplication.class)
|
||||
public class CommitIdTest {
|
||||
|
||||
@Value("${git.commit.message.short}")
|
||||
private static final String UNKNOWN_STATUS = "UNKNOWN";
|
||||
|
||||
@Value("${git.commit.message.short:#{'UNKNOWN'}}")
|
||||
private String commitMessage;
|
||||
|
||||
@Value("${git.branch}")
|
||||
@Value("${git.branch:#{'UNKNOWN'}")
|
||||
private String branch;
|
||||
|
||||
@Value("${git.commit.id}")
|
||||
@Value("${git.commit.id:#{'UNKNOWN'}")
|
||||
private String commitId;
|
||||
|
||||
@Test
|
||||
public void shouldInjectGitInfoProperties() throws Exception {
|
||||
|
||||
assertThat(commitMessage)
|
||||
.isNotNull()
|
||||
.isNotEqualTo("${git.commit.message.short}");
|
||||
.isNotEqualTo(UNKNOWN_STATUS);
|
||||
|
||||
assertThat(branch)
|
||||
.isNotNull()
|
||||
.isNotEqualTo("${git.branch}");
|
||||
.isNotEqualTo(UNKNOWN_STATUS);
|
||||
|
||||
assertThat(commitId)
|
||||
.isNotNull()
|
||||
.isNotEqualTo("${git.commit.id}");
|
||||
.isNotEqualTo(UNKNOWN_STATUS);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue