From 76696dc4db6d4e3944a4732279b381bee3716f49 Mon Sep 17 00:00:00 2001 From: TheSnoozer Date: Sat, 2 Mar 2024 08:48:10 +0100 Subject: [PATCH] ensure all properties are generated --- .../git/GitCommitIdMojoIntegrationTest.java | 14 +----------- .../maven/git/GitIntegrationTest.java | 22 ++++++++++++++++--- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/test/java/pl/project13/maven/git/GitCommitIdMojoIntegrationTest.java b/src/test/java/pl/project13/maven/git/GitCommitIdMojoIntegrationTest.java index 4bba944c..ee1a0608 100644 --- a/src/test/java/pl/project13/maven/git/GitCommitIdMojoIntegrationTest.java +++ b/src/test/java/pl/project13/maven/git/GitCommitIdMojoIntegrationTest.java @@ -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 diff --git a/src/test/java/pl/project13/maven/git/GitIntegrationTest.java b/src/test/java/pl/project13/maven/git/GitIntegrationTest.java index 8c8b4fab..c44556ae 100644 --- a/src/test/java/pl/project13/maven/git/GitIntegrationTest.java +++ b/src/test/java/pl/project13/maven/git/GitIntegrationTest.java @@ -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")); } }