mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Decorate all Assert implementations with @CheckReturnValue
See gh-46766 Signed-off-by: Stefano Cordio <stefano.cordio@gmail.com>
This commit is contained in:
committed by
Stéphane Nicoll
parent
458f7f6ac9
commit
b2b0fed285
+6
@@ -32,6 +32,7 @@ import org.assertj.core.api.ListAssert;
|
||||
import org.assertj.core.api.ObjectAssert;
|
||||
|
||||
import org.springframework.boot.test.json.JsonContentAssert;
|
||||
import org.springframework.lang.CheckReturnValue;
|
||||
|
||||
/**
|
||||
* AssertJ {@link org.assertj.core.api.Assert} for Docker image container configuration.
|
||||
@@ -99,10 +100,12 @@ public class ContainerConfigAssert extends AbstractAssert<ContainerConfigAssert,
|
||||
super(jsonContentAssert, BuildMetadataAssert.class);
|
||||
}
|
||||
|
||||
@CheckReturnValue
|
||||
public ListAssert<Object> buildpacks() {
|
||||
return this.actual.extractingJsonPathArrayValue("$.buildpacks[*].id");
|
||||
}
|
||||
|
||||
@CheckReturnValue
|
||||
public AbstractListAssert<?, List<? extends String>, String, ObjectAssert<String>> processOfType(String type) {
|
||||
return this.actual.extractingJsonPathArrayValue("$.processes[?(@.type=='%s')]", type)
|
||||
.singleElement()
|
||||
@@ -132,14 +135,17 @@ public class ContainerConfigAssert extends AbstractAssert<ContainerConfigAssert,
|
||||
super(jsonContentAssert, LifecycleMetadataAssert.class);
|
||||
}
|
||||
|
||||
@CheckReturnValue
|
||||
public ListAssert<Object> buildpackLayers(String buildpackId) {
|
||||
return this.actual.extractingJsonPathArrayValue("$.buildpacks[?(@.key=='%s')].layers", buildpackId);
|
||||
}
|
||||
|
||||
@CheckReturnValue
|
||||
public AbstractListAssert<?, List<?>, Object, ObjectAssert<Object>> appLayerShas() {
|
||||
return this.actual.extractingJsonPathArrayValue("$.app").extracting("sha");
|
||||
}
|
||||
|
||||
@CheckReturnValue
|
||||
public AbstractObjectAssert<?, Object> sbomLayerSha() {
|
||||
return this.actual.extractingJsonPathValue("$.sbom.sha");
|
||||
}
|
||||
|
||||
+2
@@ -34,6 +34,7 @@ import org.springframework.boot.buildpack.platform.docker.DockerApi;
|
||||
import org.springframework.boot.buildpack.platform.docker.type.ImageReference;
|
||||
import org.springframework.boot.buildpack.platform.docker.type.Layer;
|
||||
import org.springframework.boot.test.json.JsonContentAssert;
|
||||
import org.springframework.lang.CheckReturnValue;
|
||||
import org.springframework.util.StreamUtils;
|
||||
|
||||
/**
|
||||
@@ -73,6 +74,7 @@ public class ImageAssert extends AbstractAssert<ImageAssert, ImageReference> {
|
||||
super(layer, LayerContentAssert.class);
|
||||
}
|
||||
|
||||
@CheckReturnValue
|
||||
public ListAssert<String> entries() {
|
||||
List<String> entryNames = new ArrayList<>();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user