From 334e2c43e384c67b67e2ca78a71136bd168e9313 Mon Sep 17 00:00:00 2001 From: Alexis Date: Thu, 29 Aug 2024 21:15:52 +0200 Subject: [PATCH] Code formatting improvements --- .../version/ArtifactAvailableVersionsTest.java | 8 +++++--- .../mvncheck/core/component/build/BuildTest.java | 11 ++++++----- .../mvncheck/core/util/DecryptedSettingsTest.java | 11 ++++++----- src/test/resources/.mvnchk-ignore_bom | 2 +- src/test/resources/.mvnchk-ignore_foo | 2 +- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/test/java/com/github/alexisjehan/mvncheck/core/component/artifact/version/ArtifactAvailableVersionsTest.java b/src/test/java/com/github/alexisjehan/mvncheck/core/component/artifact/version/ArtifactAvailableVersionsTest.java index 976726d..c2e9222 100644 --- a/src/test/java/com/github/alexisjehan/mvncheck/core/component/artifact/version/ArtifactAvailableVersionsTest.java +++ b/src/test/java/com/github/alexisjehan/mvncheck/core/component/artifact/version/ArtifactAvailableVersionsTest.java @@ -58,9 +58,11 @@ final class ArtifactAvailableVersionsTest { @Test void testConstructorImmutable() { final var availableVersions = new ArrayList<>(AVAILABLE_VERSIONS); - final var artifactAvailableVersions = new ArtifactAvailableVersions(ARTIFACT, availableVersions); - availableVersions.clear(); - assertThat(artifactAvailableVersions.getAvailableVersions()).isEqualTo(AVAILABLE_VERSIONS); + assertThat(new ArtifactAvailableVersions(ARTIFACT, availableVersions)) + .satisfies(immutableArtifactAvailableVersions -> { + availableVersions.clear(); + assertThat(immutableArtifactAvailableVersions.getAvailableVersions()).isEqualTo(AVAILABLE_VERSIONS); + }); } @Test diff --git a/src/test/java/com/github/alexisjehan/mvncheck/core/component/build/BuildTest.java b/src/test/java/com/github/alexisjehan/mvncheck/core/component/build/BuildTest.java index 0b209aa..a95d9e1 100644 --- a/src/test/java/com/github/alexisjehan/mvncheck/core/component/build/BuildTest.java +++ b/src/test/java/com/github/alexisjehan/mvncheck/core/component/build/BuildTest.java @@ -72,11 +72,12 @@ final class BuildTest { void testConstructorImmutable() { final var repositories = new ArrayList<>(REPOSITORIES); final var artifacts = new ArrayList<>(ARTIFACTS); - final var build = new Build(FILE, repositories, artifacts); - repositories.clear(); - artifacts.clear(); - assertThat(build.getRepositories()).isEqualTo(REPOSITORIES); - assertThat(build.getArtifacts()).isEqualTo(ARTIFACTS); + assertThat(new Build(FILE, repositories, artifacts)).satisfies(immutableBuild -> { + repositories.clear(); + artifacts.clear(); + assertThat(immutableBuild.getRepositories()).isEqualTo(REPOSITORIES); + assertThat(immutableBuild.getArtifacts()).isEqualTo(ARTIFACTS); + }); } @Test diff --git a/src/test/java/com/github/alexisjehan/mvncheck/core/util/DecryptedSettingsTest.java b/src/test/java/com/github/alexisjehan/mvncheck/core/util/DecryptedSettingsTest.java index 78732fd..11d9e0b 100644 --- a/src/test/java/com/github/alexisjehan/mvncheck/core/util/DecryptedSettingsTest.java +++ b/src/test/java/com/github/alexisjehan/mvncheck/core/util/DecryptedSettingsTest.java @@ -48,11 +48,12 @@ final class DecryptedSettingsTest { void testConstructorImmutable() { final var proxies = new ArrayList<>(PROXIES); final var servers = new ArrayList<>(SERVERS); - final var decryptedSettings = new DecryptedSettings(proxies, servers); - proxies.clear(); - servers.clear(); - assertThat(decryptedSettings.getProxies()).isEqualTo(PROXIES); - assertThat(decryptedSettings.getServers()).isEqualTo(SERVERS); + assertThat(new DecryptedSettings(proxies, servers)).satisfies(immutableDecryptedSettings -> { + proxies.clear(); + servers.clear(); + assertThat(immutableDecryptedSettings.getProxies()).isEqualTo(PROXIES); + assertThat(immutableDecryptedSettings.getServers()).isEqualTo(SERVERS); + }); } @Test diff --git a/src/test/resources/.mvnchk-ignore_bom b/src/test/resources/.mvnchk-ignore_bom index 5740ff6..cd1bac6 100644 --- a/src/test/resources/.mvnchk-ignore_bom +++ b/src/test/resources/.mvnchk-ignore_bom @@ -1 +1 @@ -# comment \ No newline at end of file +# comment \ No newline at end of file diff --git a/src/test/resources/.mvnchk-ignore_foo b/src/test/resources/.mvnchk-ignore_foo index 5dff91f..1bac4f1 100644 --- a/src/test/resources/.mvnchk-ignore_foo +++ b/src/test/resources/.mvnchk-ignore_foo @@ -1,4 +1,4 @@ -# comment +# comment foo-group-id:foo-artifact-id foo-group-id:foo-artifact-id:foo-version foo-group-id:foo-artifact-id:FOO-VERSION