Use consistent exception messages in Assert calls

Update `Assert` calls to consistently use messages of the form
"'item' must [not] ...".

Closes gh-43780
This commit is contained in:
Phillip Webb
2025-01-09 15:33:44 -08:00
parent f08188d5cf
commit a49719d73e
559 changed files with 2001 additions and 2003 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@ class BuildOwnerTests {
@Test
void fromEnvWhenEnvIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> BuildOwner.fromEnv(null))
.withMessage("Env must not be null");
.withMessage("'env' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -88,20 +88,20 @@ class BuildRequestTests {
@Test
void forJarFileWhenJarFileIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> BuildRequest.forJarFile(null))
.withMessage("JarFile must not be null");
.withMessage("'jarFile' must not be null");
}
@Test
void forJarFileWhenJarFileIsMissingThrowsException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> BuildRequest.forJarFile(new File(this.tempDir, "missing.jar")))
.withMessage("JarFile must exist");
.withMessage("'jarFile' must exist");
}
@Test
void forJarFileWhenJarFileIsDirectoryThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> BuildRequest.forJarFile(this.tempDir))
.withMessage("JarFile must be a file");
.withMessage("'jarFile' must be a file");
}
@Test
@@ -217,14 +217,14 @@ class BuildRequestTests {
void withEnvWhenKeyIsNullThrowsException() throws IOException {
BuildRequest request = BuildRequest.forJarFile(writeTestJarFile("my-app-0.0.1.jar"));
assertThatIllegalArgumentException().isThrownBy(() -> request.withEnv(null, "test"))
.withMessage("Name must not be empty");
.withMessage("'name' must not be empty");
}
@Test
void withEnvWhenValueIsNullThrowsException() throws IOException {
BuildRequest request = BuildRequest.forJarFile(writeTestJarFile("my-app-0.0.1.jar"));
assertThatIllegalArgumentException().isThrownBy(() -> request.withEnv("test", null))
.withMessage("Value must not be empty");
.withMessage("'value' must not be empty");
}
@Test
@@ -241,7 +241,7 @@ class BuildRequestTests {
void withBuildpacksWhenBuildpacksIsNullThrowsException() throws IOException {
BuildRequest request = BuildRequest.forJarFile(writeTestJarFile("my-app-0.0.1.jar"));
assertThatIllegalArgumentException().isThrownBy(() -> request.withBuildpacks((List<BuildpackReference>) null))
.withMessage("Buildpacks must not be null");
.withMessage("'buildpacks' must not be null");
}
@Test
@@ -258,7 +258,7 @@ class BuildRequestTests {
void withBindingsWhenBindingsIsNullThrowsException() throws IOException {
BuildRequest request = BuildRequest.forJarFile(writeTestJarFile("my-app-0.0.1.jar"));
assertThatIllegalArgumentException().isThrownBy(() -> request.withBindings((List<Binding>) null))
.withMessage("Bindings must not be null");
.withMessage("'bindings' must not be null");
}
@Test
@@ -283,7 +283,7 @@ class BuildRequestTests {
void withTagsWhenTagsIsNullThrowsException() throws IOException {
BuildRequest request = BuildRequest.forJarFile(writeTestJarFile("my-app-0.0.1.jar"));
assertThatIllegalArgumentException().isThrownBy(() -> request.withTags((List<ImageReference>) null))
.withMessage("Tags must not be null");
.withMessage("'tags' must not be null");
}
@Test
@@ -322,7 +322,7 @@ class BuildRequestTests {
void withBuildVolumeCacheWhenCacheIsNullThrowsException() throws IOException {
BuildRequest request = BuildRequest.forJarFile(writeTestJarFile("my-app-0.0.1.jar"));
assertThatIllegalArgumentException().isThrownBy(() -> request.withBuildCache(null))
.withMessage("BuildCache must not be null");
.withMessage("'buildCache' must not be null");
}
@Test
@@ -345,7 +345,7 @@ class BuildRequestTests {
void withLaunchVolumeCacheWhenCacheIsNullThrowsException() throws IOException {
BuildRequest request = BuildRequest.forJarFile(writeTestJarFile("my-app-0.0.1.jar"));
assertThatIllegalArgumentException().isThrownBy(() -> request.withLaunchCache(null))
.withMessage("LaunchCache must not be null");
.withMessage("'launchCache' must not be null");
}
@Test

View File

@@ -90,14 +90,14 @@ class BuilderMetadataTests extends AbstractJsonTests {
@Test
void fromImageWhenImageIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> BuilderMetadata.fromImage(null))
.withMessage("Image must not be null");
.withMessage("'image' must not be null");
}
@Test
void fromImageWhenImageConfigIsNullThrowsException() {
Image image = mock(Image.class);
assertThatIllegalArgumentException().isThrownBy(() -> BuilderMetadata.fromImage(image))
.withMessage("ImageConfig must not be null");
.withMessage("'imageConfig' must not be null");
}
@Test

View File

@@ -66,7 +66,7 @@ class BuilderTests {
@Test
void createWhenLogIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> new Builder((BuildLog) null))
.withMessage("Log must not be null");
.withMessage("'log' must not be null");
}
@Test
@@ -79,7 +79,7 @@ class BuilderTests {
void buildWhenRequestIsNullThrowsException() {
Builder builder = new Builder();
assertThatIllegalArgumentException().isThrownBy(() -> builder.build(null))
.withMessage("Request must not be null");
.withMessage("'request' must not be null");
}
@Test

View File

@@ -55,14 +55,14 @@ class BuildpackLayersMetadataTests extends AbstractJsonTests {
@Test
void fromImageWhenImageIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackLayersMetadata.fromImage(null))
.withMessage("Image must not be null");
.withMessage("'image' must not be null");
}
@Test
void fromImageWhenImageConfigIsNullThrowsException() {
Image image = mock(Image.class);
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackLayersMetadata.fromImage(image))
.withMessage("ImageConfig must not be null");
.withMessage("'imageConfig' must not be null");
}
@Test

View File

@@ -49,14 +49,14 @@ class BuildpackMetadataTests extends AbstractJsonTests {
@Test
void fromImageWhenImageIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackMetadata.fromImage(null))
.withMessage("Image must not be null");
.withMessage("'image' must not be null");
}
@Test
void fromImageWhenImageConfigIsNullThrowsException() {
Image image = mock(Image.class);
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackMetadata.fromImage(image))
.withMessage("ImageConfig must not be null");
.withMessage("'imageConfig' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@ class BuildpackReferenceTests {
@Test
void ofWhenValueIsEmptyThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackReference.of(""))
.withMessage("Value must not be empty");
.withMessage("'value' must not be empty");
}
@Test

View File

@@ -166,7 +166,7 @@ class ImageBuildpackTests extends AbstractJsonTests {
BuildpackReference reference = BuildpackReference.of("docker://buildpack@0.0.1");
BuildpackResolverContext resolverContext = mock(BuildpackResolverContext.class);
assertThatIllegalArgumentException().isThrownBy(() -> ImageBuildpack.resolve(resolverContext, reference))
.withMessageContaining("Unable to parse image reference \"buildpack@0.0.1\"");
.withMessageContaining("'value' [buildpack@0.0.1] must be an image reference");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,19 +31,19 @@ class LifecycleVersionTests {
@Test
void parseWhenValueIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> LifecycleVersion.parse(null))
.withMessage("Value must not be empty");
.withMessage("'value' must not be empty");
}
@Test
void parseWhenTooLongThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> LifecycleVersion.parse("v1.2.3.4"))
.withMessage("Malformed version number '1.2.3.4'");
.withMessage("'value' [v1.2.3.4] must be a valid version number");
}
@Test
void parseWhenNonNumericThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> LifecycleVersion.parse("v1.2.3a"))
.withMessage("Malformed version number '1.2.3a'");
.withMessage("'value' [v1.2.3a] must be a valid version number");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ class StackIdTests {
@Test
void fromImageWhenImageIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> StackId.fromImage(null))
.withMessage("Image must not be null");
.withMessage("'image' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -194,14 +194,14 @@ class DockerApiTests {
@Test
void pullWhenReferenceIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.api.pull(null, null, this.pullListener))
.withMessage("Reference must not be null");
.withMessage("'reference' must not be null");
}
@Test
void pullWhenListenerIsNullThrowsException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> this.api.pull(ImageReference.of("ubuntu"), null, null))
.withMessage("Listener must not be null");
.withMessage("'listener' must not be null");
}
@Test
@@ -267,14 +267,14 @@ class DockerApiTests {
@Test
void pushWhenReferenceIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.api.push(null, this.pushListener, null))
.withMessage("Reference must not be null");
.withMessage("'reference' must not be null");
}
@Test
void pushWhenListenerIsNullThrowsException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> this.api.push(ImageReference.of("ubuntu"), null, null))
.withMessage("Listener must not be null");
.withMessage("'listener' must not be null");
}
@Test
@@ -302,14 +302,14 @@ class DockerApiTests {
@Test
void loadWhenArchiveIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.api.load(null, UpdateListener.none()))
.withMessage("Archive must not be null");
.withMessage("'archive' must not be null");
}
@Test
void loadWhenListenerIsNullThrowsException() {
ImageArchive archive = mock(ImageArchive.class);
assertThatIllegalArgumentException().isThrownBy(() -> this.api.load(archive, null))
.withMessage("Listener must not be null");
.withMessage("'listener' must not be null");
}
@Test // gh-23130
@@ -352,7 +352,7 @@ class DockerApiTests {
@Test
void removeWhenReferenceIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.api.remove(null, true))
.withMessage("Reference must not be null");
.withMessage("'reference' must not be null");
}
@Test
@@ -380,7 +380,7 @@ class DockerApiTests {
@Test
void inspectWhenReferenceIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.api.inspect(null))
.withMessage("Reference must not be null");
.withMessage("'reference' must not be null");
}
@Test
@@ -396,7 +396,7 @@ class DockerApiTests {
@SuppressWarnings("removal")
void exportLayersWhenReferenceIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.api.exportLayerFiles(null, (name, archive) -> {
})).withMessage("Reference must not be null");
})).withMessage("'reference' must not be null");
}
@Test
@@ -404,7 +404,7 @@ class DockerApiTests {
void exportLayersWhenExportsIsNullThrowsException() {
ImageReference reference = ImageReference.of("gcr.io/paketo-buildpacks/builder:base");
assertThatIllegalArgumentException().isThrownBy(() -> this.api.exportLayerFiles(reference, null))
.withMessage("Exports must not be null");
.withMessage("'exports' must not be null");
}
@Test
@@ -490,14 +490,14 @@ class DockerApiTests {
void tagWhenReferenceIsNullThrowsException() {
ImageReference tag = ImageReference.of("localhost:5000/ubuntu");
assertThatIllegalArgumentException().isThrownBy(() -> this.api.tag(null, tag))
.withMessage("SourceReference must not be null");
.withMessage("'sourceReference' must not be null");
}
@Test
void tagWhenTargetIsNullThrowsException() {
ImageReference reference = ImageReference.of("localhost:5000/ubuntu");
assertThatIllegalArgumentException().isThrownBy(() -> this.api.tag(reference, null))
.withMessage("TargetReference must not be null");
.withMessage("'targetReference' must not be null");
}
@Test
@@ -541,7 +541,7 @@ class DockerApiTests {
@Test
void createWhenConfigIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.api.create(null, null))
.withMessage("Config must not be null");
.withMessage("'config' must not be null");
}
@Test
@@ -628,7 +628,7 @@ class DockerApiTests {
@Test
void startWhenReferenceIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.api.start(null))
.withMessage("Reference must not be null");
.withMessage("'reference' must not be null");
}
@Test
@@ -643,14 +643,14 @@ class DockerApiTests {
@Test
void logsWhenReferenceIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.api.logs(null, UpdateListener.none()))
.withMessage("Reference must not be null");
.withMessage("'reference' must not be null");
}
@Test
void logsWhenListenerIsNullThrowsException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> this.api.logs(ContainerReference.of("e90e34656806"), null))
.withMessage("Listener must not be null");
.withMessage("'listener' must not be null");
}
@Test
@@ -668,7 +668,7 @@ class DockerApiTests {
@Test
void waitWhenReferenceIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.api.wait(null))
.withMessage("Reference must not be null");
.withMessage("'reference' must not be null");
}
@Test
@@ -683,7 +683,7 @@ class DockerApiTests {
@Test
void removeWhenReferenceIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.api.remove(null, true))
.withMessage("Reference must not be null");
.withMessage("'reference' must not be null");
}
@Test
@@ -719,7 +719,7 @@ class DockerApiTests {
@Test
void deleteWhenNameIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.api.delete(null, false))
.withMessage("Name must not be null");
.withMessage("'name' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,13 +38,13 @@ class TotalProgressEventTests {
@Test
void createWhenPercentLessThanZeroThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> new TotalProgressEvent(-1))
.withMessage("Percent must be in the range 0 to 100");
.withMessage("'percent' must be in the range 0 to 100");
}
@Test
void createWhenEventMoreThanOneHundredThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> new TotalProgressEvent(101))
.withMessage("Percent must be in the range 0 to 100");
.withMessage("'percent' must be in the range 0 to 100");
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,13 +35,13 @@ class DockerConnectionExceptionTests {
@Test
void createWhenHostIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> new DockerConnectionException(null, null))
.withMessage("Host must not be null");
.withMessage("'host' must not be null");
}
@Test
void createWhenCauseIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> new DockerConnectionException(HOST, null))
.withMessage("Cause must not be null");
.withMessage("'cause' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,14 +57,14 @@ class DockerEngineExceptionTests {
void createWhenHostIsNullThrowsException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new DockerEngineException(null, null, 404, null, NO_ERRORS, NO_MESSAGE))
.withMessage("Host must not be null");
.withMessage("'host' must not be null");
}
@Test
void createWhenUriIsNullThrowsException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new DockerEngineException(HOST, null, 404, null, NO_ERRORS, NO_MESSAGE))
.withMessage("URI must not be null");
.withMessage("'uri' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,19 +34,19 @@ class ApiVersionTests {
@Test
void parseWhenVersionIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> ApiVersion.parse(null))
.withMessage("Value must not be empty");
.withMessage("'value' must not be empty");
}
@Test
void parseWhenVersionIsEmptyThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> ApiVersion.parse(""))
.withMessage("Value must not be empty");
.withMessage("'value' must not be empty");
}
@Test
void parseWhenVersionDoesNotMatchPatternThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> ApiVersion.parse("bad"))
.withMessage("Malformed version number 'bad'");
.withMessage("'value' [bad] must contain a well formed version number");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@ class BindingTests {
@Test
void ofWithNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> Binding.of(null))
.withMessageContaining("Value must not be null");
.withMessageContaining("'value' must not be null");
}
@Test
@@ -53,13 +53,13 @@ class BindingTests {
@Test
void fromWithNullSourceThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> Binding.from((String) null, "container-dest"))
.withMessageContaining("Source must not be null");
.withMessageContaining("'source' must not be null");
}
@Test
void fromWithNullDestinationThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> Binding.from("host-src", null))
.withMessageContaining("Destination must not be null");
.withMessageContaining("'destination' must not be null");
}
@Test
@@ -71,7 +71,7 @@ class BindingTests {
@Test
void fromVolumeNameSourceWithNullSourceThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> Binding.from((VolumeName) null, "container-dest"))
.withMessageContaining("SourceVolume must not be null");
.withMessageContaining("'sourceVolume' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,14 +39,14 @@ class ContainerConfigTests extends AbstractJsonTests {
@Test
void ofWhenImageReferenceIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> ContainerConfig.of(null, (update) -> {
})).withMessage("ImageReference must not be null");
})).withMessage("'imageReference' must not be null");
}
@Test
void ofWhenUpdateIsNullThrowsException() {
ImageReference imageReference = ImageReference.of("ubuntu:bionic");
assertThatIllegalArgumentException().isThrownBy(() -> ContainerConfig.of(imageReference, null))
.withMessage("Update must not be null");
.withMessage("'update' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,21 +34,21 @@ class ContainerContentTests {
@Test
void ofWhenArchiveIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> ContainerContent.of(null))
.withMessage("Archive must not be null");
.withMessage("'archive' must not be null");
}
@Test
void ofWhenDestinationPathIsNullThrowsException() {
TarArchive archive = mock(TarArchive.class);
assertThatIllegalArgumentException().isThrownBy(() -> ContainerContent.of(archive, null))
.withMessage("DestinationPath must not be empty");
.withMessage("'destinationPath' must not be empty");
}
@Test
void ofWhenDestinationPathIsEmptyThrowsException() {
TarArchive archive = mock(TarArchive.class);
assertThatIllegalArgumentException().isThrownBy(() -> ContainerContent.of(archive, ""))
.withMessage("DestinationPath must not be empty");
.withMessage("'destinationPath' must not be empty");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,13 +38,13 @@ class ContainerReferenceTests {
@Test
void ofWhenNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> ContainerReference.of(null))
.withMessage("Value must not be empty");
.withMessage("'value' must not be empty");
}
@Test
void ofWhenEmptyThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> ContainerReference.of(""))
.withMessage("Value must not be empty");
.withMessage("'value' must not be empty");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -118,25 +118,26 @@ class ImageNameTests {
@Test
void ofWhenNameIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> ImageName.of(null))
.withMessage("Value must not be empty");
.withMessage("'value' must not be empty");
}
@Test
void ofWhenNameIsEmptyThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> ImageName.of("")).withMessage("Value must not be empty");
assertThatIllegalArgumentException().isThrownBy(() -> ImageName.of(""))
.withMessage("'value' must not be empty");
}
@Test
void ofWhenContainsUppercaseThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> ImageName.of("Test"))
.withMessageContaining("Unable to parse name")
.withMessageContaining("must be a parsable name")
.withMessageContaining("Test");
}
@Test
void ofWhenNameIncludesTagThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> ImageName.of("ubuntu:latest"))
.withMessageContaining("Unable to parse name")
.withMessageContaining("must be a parsable name")
.withMessageContaining(":latest");
}
@@ -144,7 +145,7 @@ class ImageNameTests {
void ofWhenNameIncludeDigestThrowsException() {
assertThatIllegalArgumentException().isThrownBy(
() -> ImageName.of("ubuntu@sha256:47bfdb88c3ae13e488167607973b7688f69d9e8c142c2045af343ec199649c09"))
.withMessageContaining("Unable to parse name")
.withMessageContaining("must be a parsable name")
.withMessageContaining("@sha256:47b");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,13 +48,13 @@ class ImagePlatformTests extends AbstractJsonTests {
@Test
void ofWithEmptyValueFails() {
assertThatIllegalArgumentException().isThrownBy(() -> ImagePlatform.of(""))
.withMessageContaining("Value must not be empty");
.withMessageContaining("'value' must not be empty");
}
@Test
void ofWithTooManySegmentsFails() {
assertThatIllegalArgumentException().isThrownBy(() -> ImagePlatform.of("linux/amd64/v1/extra"))
.withMessageContaining("value 'linux/amd64/v1/extra'");
.withMessageContaining("'value' [linux/amd64/v1/extra] must be in the form");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -189,7 +189,7 @@ class ImageReferenceTests {
assertThatIllegalArgumentException()
.isThrownBy(() -> ImageReference
.of("registry.example.com/example/example-app:1.6.0-dev.2.uncommitted+wip.foo.c75795d"))
.withMessageContaining("Unable to parse image reference");
.withMessageContaining("must be an image reference");
}
@Test
@@ -197,7 +197,7 @@ class ImageReferenceTests {
assertThatIllegalArgumentException()
.isThrownBy(() -> ImageReference
.of("europe-west1-docker.pkg.dev/aaaaaa-bbbbb-123456/docker-registry/bootBuildImage:0.0.1"))
.withMessageContaining("Unable to parse image reference");
.withMessageContaining("must be an image reference");
}
@Test
@@ -205,7 +205,7 @@ class ImageReferenceTests {
void ofWhenIsVeryLongAndHasIllegalCharacter() {
assertThatIllegalArgumentException().isThrownBy(() -> ImageReference
.of("docker.io/library/this-image-has-a-long-name-with-an-invalid-tag-which-is-at-danger-of-catastrophic-backtracking:1.0.0+1234"))
.withMessageContaining("Unable to parse image reference");
.withMessageContaining("must be an image reference");
}
@Test
@@ -248,7 +248,7 @@ class ImageReferenceTests {
@Test
void randomWherePrefixIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> ImageReference.random(null))
.withMessage("Prefix must not be null");
.withMessage("'prefix' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,12 +52,12 @@ class LayerIdTests {
@Test
void ofWhenValueIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> LayerId.of((String) null))
.withMessage("Value must not be empty");
.withMessage("'value' must not be empty");
}
@Test
void ofWhenValueIsEmptyThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> LayerId.of(" ")).withMessage("Value must not be empty");
assertThatIllegalArgumentException().isThrownBy(() -> LayerId.of(" ")).withMessage("'value' must not be empty");
}
@Test
@@ -80,13 +80,13 @@ class LayerIdTests {
@Test
void ofSha256DigestWhenNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> LayerId.ofSha256Digest((byte[]) null))
.withMessage("Digest must not be null");
.withMessage("'digest' must not be null");
}
@Test
void ofSha256DigestWhenWrongLengthThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> LayerId.ofSha256Digest(new byte[31]))
.withMessage("Digest must be exactly 32 bytes");
.withMessage("'digest' must be exactly 32 bytes");
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,13 +40,13 @@ class LayerTests {
@Test
void ofWhenLayoutIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> Layer.of((IOConsumer<Layout>) null))
.withMessage("Layout must not be null");
.withMessage("'layout' must not be null");
}
@Test
void fromTarArchiveWhenTarArchiveIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> Layer.fromTarArchive(null))
.withMessage("TarArchive must not be null");
.withMessage("'tarArchive' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ class RandomStringTests {
@Test
void generateWhenPrefixIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> RandomString.generate(null, 10))
.withMessage("Prefix must not be null");
.withMessage("'prefix' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ class VolumeNameTests {
@Test
void randomWhenPrefixIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> VolumeName.random(null))
.withMessage("Prefix must not be null");
.withMessage("'prefix' must not be null");
}
@Test
@@ -57,25 +57,25 @@ class VolumeNameTests {
@Test
void basedOnWhenSourceIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> VolumeName.basedOn(null, "prefix", "suffix", 6))
.withMessage("Source must not be null");
.withMessage("'source' must not be null");
}
@Test
void basedOnWhenNameExtractorIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> VolumeName.basedOn("test", null, "prefix", "suffix", 6))
.withMessage("NameExtractor must not be null");
.withMessage("'nameExtractor' must not be null");
}
@Test
void basedOnWhenPrefixIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> VolumeName.basedOn("test", null, "suffix", 6))
.withMessage("Prefix must not be null");
.withMessage("'prefix' must not be null");
}
@Test
void basedOnWhenSuffixIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> VolumeName.basedOn("test", "prefix", null, 6))
.withMessage("Suffix must not be null");
.withMessage("'suffix' must not be null");
}
@Test
@@ -87,13 +87,13 @@ class VolumeNameTests {
@Test
void basedOnWhenSizeIsTooBigThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> VolumeName.basedOn("name", "prefix", "suffix", 33))
.withMessage("DigestLength must be less than or equal to 32");
.withMessage("'digestLength' must be less than or equal to 32");
}
@Test
void ofWhenValueIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> VolumeName.of(null))
.withMessage("Value must not be null");
.withMessage("'value' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,9 +35,9 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class ContentTests {
@Test
void ofWhenStreamIsNullThrowsException() {
void ofWhenSupplierIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> Content.of(1, (IOSupplier<InputStream>) null))
.withMessage("Supplier must not be null");
.withMessage("'supplier' must not be null");
}
@Test
@@ -51,7 +51,7 @@ class ContentTests {
@Test
void ofWhenStringIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> Content.of((String) null))
.withMessage("String must not be null");
.withMessage("'string' must not be null");
}
@Test
@@ -63,7 +63,7 @@ class ContentTests {
@Test
void ofWhenBytesIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> Content.of((byte[]) null))
.withMessage("Bytes must not be null");
.withMessage("'bytes' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,19 +39,19 @@ class InspectedContentTests {
@Test
void ofWhenInputStreamThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> InspectedContent.of((InputStream) null))
.withMessage("InputStream must not be null");
.withMessage("'inputStream' must not be null");
}
@Test
void ofWhenContentIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> InspectedContent.of((Content) null))
.withMessage("Content must not be null");
.withMessage("'content' must not be null");
}
@Test
void ofWhenConsumerIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> InspectedContent.of((IOConsumer<OutputStream>) null))
.withMessage("Writer must not be null");
.withMessage("'writer' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ class ZipFileTarArchiveTests {
@Test
void createWhenZipIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> new ZipFileTarArchive(null, Owner.ROOT))
.withMessage("Zip must not be null");
.withMessage("'zip' must not be null");
}
@Test
@@ -54,7 +54,7 @@ class ZipFileTarArchiveTests {
File file = new File(this.tempDir, "test.zip");
writeTestZip(file);
assertThatIllegalArgumentException().isThrownBy(() -> new ZipFileTarArchive(file, null))
.withMessage("Owner must not be null");
.withMessage("'owner' must not be null");
}
@Test