mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Use static imports for Assertions.assertThat() consistently
See gh-48630 Signed-off-by: Johnny Lim <izeye@naver.com>
This commit is contained in:
committed by
Stéphane Nicoll
parent
54d7f79501
commit
88f51fafee
+8
-7
@@ -30,7 +30,6 @@ import org.assertj.core.api.AbstractBooleanAssert;
|
||||
import org.assertj.core.api.AbstractCharSequenceAssert;
|
||||
import org.assertj.core.api.AbstractObjectAssert;
|
||||
import org.assertj.core.api.Assert;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.assertj.core.api.ListAssert;
|
||||
import org.assertj.core.api.MapAssert;
|
||||
import org.skyscreamer.jsonassert.JSONCompare;
|
||||
@@ -42,6 +41,8 @@ import org.springframework.core.io.Resource;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* AssertJ {@link Assert} for {@link JsonContent}.
|
||||
*
|
||||
@@ -915,7 +916,7 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
||||
* @throws AssertionError if the path is not valid
|
||||
*/
|
||||
public AbstractObjectAssert<?, Object> extractingJsonPathValue(CharSequence expression, Object... args) {
|
||||
return Assertions.assertThat(new JsonPathValue(expression, args).getValue(false));
|
||||
return assertThat(new JsonPathValue(expression, args).getValue(false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -928,7 +929,7 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
||||
*/
|
||||
public AbstractCharSequenceAssert<?, String> extractingJsonPathStringValue(CharSequence expression,
|
||||
Object... args) {
|
||||
return Assertions.assertThat(extractingJsonPathValue(expression, args, String.class, "a string"));
|
||||
return assertThat(extractingJsonPathValue(expression, args, String.class, "a string"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -940,7 +941,7 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
||||
* @throws AssertionError if the path is not valid or does not result in a number
|
||||
*/
|
||||
public AbstractObjectAssert<?, Number> extractingJsonPathNumberValue(CharSequence expression, Object... args) {
|
||||
return Assertions.assertThat(extractingJsonPathValue(expression, args, Number.class, "a number"));
|
||||
return assertThat(extractingJsonPathValue(expression, args, Number.class, "a number"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -952,7 +953,7 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
||||
* @throws AssertionError if the path is not valid or does not result in a boolean
|
||||
*/
|
||||
public AbstractBooleanAssert<?> extractingJsonPathBooleanValue(CharSequence expression, Object... args) {
|
||||
return Assertions.assertThat(extractingJsonPathValue(expression, args, Boolean.class, "a boolean"));
|
||||
return assertThat(extractingJsonPathValue(expression, args, Boolean.class, "a boolean"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -966,7 +967,7 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <E> ListAssert<E> extractingJsonPathArrayValue(CharSequence expression, Object... args) {
|
||||
return Assertions.assertThat(extractingJsonPathValue(expression, args, List.class, "an array"));
|
||||
return assertThat(extractingJsonPathValue(expression, args, List.class, "an array"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -981,7 +982,7 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <K, V> MapAssert<K, V> extractingJsonPathMapValue(CharSequence expression, Object... args) {
|
||||
return Assertions.assertThat(extractingJsonPathValue(expression, args, Map.class, "a map"));
|
||||
return assertThat(extractingJsonPathValue(expression, args, Map.class, "a map"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
+3
-2
@@ -27,7 +27,6 @@ import java.util.function.Consumer;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
|
||||
import org.assertj.core.api.AbstractAssert;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.assertj.core.api.ListAssert;
|
||||
|
||||
import org.springframework.boot.buildpack.platform.docker.DockerApi;
|
||||
@@ -36,6 +35,8 @@ import org.springframework.boot.buildpack.platform.docker.type.Layer;
|
||||
import org.springframework.boot.test.json.JsonContentAssert;
|
||||
import org.springframework.util.StreamUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* AssertJ {@link org.assertj.core.api.Assert} for Docker image contents.
|
||||
*
|
||||
@@ -92,7 +93,7 @@ public class ImageAssert extends AbstractAssert<ImageAssert, ImageReference> {
|
||||
catch (IOException ex) {
|
||||
failWithMessage("IOException while reading image layer archive: '%s'", ex.getMessage());
|
||||
}
|
||||
return Assertions.assertThat(entryNames);
|
||||
return assertThat(entryNames);
|
||||
}
|
||||
|
||||
public void jsonEntry(String name, Consumer<JsonContentAssert> assertConsumer) {
|
||||
|
||||
Reference in New Issue
Block a user