Skip to content

Commit

Permalink
ensure all properties are generated
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSnoozer committed Mar 2, 2024
1 parent ff14fdc commit 76696dc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,7 @@ public void shouldIncludeExpectedProperties(boolean useNativeGit) throws Excepti

// then
Properties properties = targetProject.getProperties();

assertThat(properties).satisfies(new ContainsKeyCondition("git.branch"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.dirty"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.full"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.abbrev"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.user.name"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.user.email"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.user.name"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.user.email"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.message.full"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.message.short"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.time"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.remote.origin.url"));
assertGitPropertiesPresentInProject(properties);
}

@Test
Expand Down
22 changes: 19 additions & 3 deletions src/test/java/pl/project13/maven/git/GitIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,24 +169,40 @@ public static void assertPropertyPresentAndEqual(
assertThat(properties.getProperty(key)).isEqualTo(expected);
}

/**
* Ensures that the provided properties contain the properties the plugin can generate.
* See also {@link pl.project13.core.GitCommitPropertyConstant}
*
* @param properties The properties that should be verified
*/
public static void assertGitPropertiesPresentInProject(Properties properties) {
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.time"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.host"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.branch"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.local.branch.ahead"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.local.branch.behind"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.dirty"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.full"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.abbrev"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.describe"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.describe-short"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.user.name"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.user.email"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.time"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.version"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.host"));
// assertThat(properties).satisfies(new ContainsKeyCondition("git.build.number"));
// assertThat(properties).satisfies(new ContainsKeyCondition("git.build.number.unique"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.user.name"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.user.email"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.message.full"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.message.short"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.time"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.committer.time"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.author.time"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.committer.time"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.remote.origin.url"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.tags"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.closest.tag.name"));
// assertThat(properties).satisfies(new ContainsKeyCondition("git.tag"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.closest.tag.commit.count"));
assertThat(properties).satisfies(new ContainsKeyCondition("git.total.commit.count"));
}
}

0 comments on commit 76696dc

Please sign in to comment.