use of org.springframework.boot.info.GitProperties in project spring-boot by spring-projects.
the class GitInfoContributorTests method coerceDate.
@SuppressWarnings("unchecked")
@Test
public void coerceDate() {
Properties properties = new Properties();
properties.put("branch", "master");
properties.put("commit.time", "2016-03-04T14:36:33+0100");
GitInfoContributor contributor = new GitInfoContributor(new GitProperties(properties));
Map<String, Object> content = contributor.generateContent();
assertThat(content.get("commit")).isInstanceOf(Map.class);
Map<String, Object> commit = (Map<String, Object>) content.get("commit");
Object commitTime = commit.get("time");
assertThat(commitTime).isInstanceOf(Date.class);
assertThat(((Date) commitTime).getTime()).isEqualTo(1457098593000L);
}
Aggregations