mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Upgrade to AssertJ 3.25.1
Closes gh-38997
This commit is contained in:
parent
c19c18f998
commit
a1c7c0bccc
@ -4,7 +4,7 @@ org.gradle.caching=true
|
|||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8
|
org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8
|
||||||
|
|
||||||
assertjVersion=3.24.2
|
assertjVersion=3.25.1
|
||||||
commonsCodecVersion=1.16.0
|
commonsCodecVersion=1.16.0
|
||||||
hamcrestVersion=2.2
|
hamcrestVersion=2.2
|
||||||
jacksonVersion=2.15.3
|
jacksonVersion=2.15.3
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -29,6 +29,7 @@ import io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider;
|
|||||||
import io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider;
|
import io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider;
|
||||||
import io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener;
|
import io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener;
|
||||||
import io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener;
|
import io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener;
|
||||||
|
import org.assertj.core.api.InstanceOfAssertFactories;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun;
|
import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun;
|
||||||
@ -62,7 +63,7 @@ class MongoMetricsAutoConfigurationTests {
|
|||||||
assertThat(context).hasSingleBean(MongoMetricsCommandListener.class);
|
assertThat(context).hasSingleBean(MongoMetricsCommandListener.class);
|
||||||
assertThat(getActualMongoClientSettingsUsedToConstructClient(context))
|
assertThat(getActualMongoClientSettingsUsedToConstructClient(context))
|
||||||
.extracting(MongoClientSettings::getCommandListeners)
|
.extracting(MongoClientSettings::getCommandListeners)
|
||||||
.asList()
|
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||||
.containsExactly(context.getBean(MongoMetricsCommandListener.class));
|
.containsExactly(context.getBean(MongoMetricsCommandListener.class));
|
||||||
assertThat(getMongoCommandTagsProviderUsedToConstructListener(context))
|
assertThat(getMongoCommandTagsProviderUsedToConstructListener(context))
|
||||||
.isInstanceOf(DefaultMongoCommandTagsProvider.class);
|
.isInstanceOf(DefaultMongoCommandTagsProvider.class);
|
||||||
@ -168,7 +169,7 @@ class MongoMetricsAutoConfigurationTests {
|
|||||||
assertThat(context).doesNotHaveBean(MongoMetricsCommandListener.class);
|
assertThat(context).doesNotHaveBean(MongoMetricsCommandListener.class);
|
||||||
assertThat(getActualMongoClientSettingsUsedToConstructClient(context))
|
assertThat(getActualMongoClientSettingsUsedToConstructClient(context))
|
||||||
.extracting(MongoClientSettings::getCommandListeners)
|
.extracting(MongoClientSettings::getCommandListeners)
|
||||||
.asList()
|
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||||
.isEmpty();
|
.isEmpty();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -333,13 +333,13 @@ class BraveAutoConfigurationTests {
|
|||||||
.getBean(CompositeSpanHandlerComponentsConfiguration.class);
|
.getBean(CompositeSpanHandlerComponentsConfiguration.class);
|
||||||
CompositeSpanHandler composite = context.getBean(CompositeSpanHandler.class);
|
CompositeSpanHandler composite = context.getBean(CompositeSpanHandler.class);
|
||||||
assertThat(composite).extracting("spanFilters")
|
assertThat(composite).extracting("spanFilters")
|
||||||
.asList()
|
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||||
.containsExactly(components.filter1, components.filter2);
|
.containsExactly(components.filter1, components.filter2);
|
||||||
assertThat(composite).extracting("filters")
|
assertThat(composite).extracting("filters")
|
||||||
.asList()
|
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||||
.containsExactly(components.predicate2, components.predicate1);
|
.containsExactly(components.predicate2, components.predicate1);
|
||||||
assertThat(composite).extracting("reporters")
|
assertThat(composite).extracting("reporters")
|
||||||
.asList()
|
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||||
.containsExactly(components.reporter1, components.reporter3, components.reporter2);
|
.containsExactly(components.reporter1, components.reporter3, components.reporter2);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -26,6 +26,7 @@ import java.util.function.Function;
|
|||||||
|
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import org.assertj.core.api.InstanceOfAssertFactories;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.io.TempDir;
|
import org.junit.jupiter.api.io.TempDir;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
@ -143,7 +144,8 @@ class WebMvcEndpointChildContextConfigurationIntegrationTests {
|
|||||||
(value) -> assertThat(value).asString().contains("MethodArgumentNotValidException"));
|
(value) -> assertThat(value).asString().contains("MethodArgumentNotValidException"));
|
||||||
assertThat(body).hasEntrySatisfying("message",
|
assertThat(body).hasEntrySatisfying("message",
|
||||||
(value) -> assertThat(value).asString().contains("Validation failed"));
|
(value) -> assertThat(value).asString().contains("Validation failed"));
|
||||||
assertThat(body).hasEntrySatisfying("errors", (value) -> assertThat(value).asList().isNotEmpty());
|
assertThat(body).hasEntrySatisfying("errors",
|
||||||
|
(value) -> assertThat(value).asInstanceOf(InstanceOfAssertFactories.LIST).isNotEmpty());
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -26,6 +26,7 @@ import javax.management.MBeanException;
|
|||||||
import javax.management.MBeanInfo;
|
import javax.management.MBeanInfo;
|
||||||
import javax.management.ReflectionException;
|
import javax.management.ReflectionException;
|
||||||
|
|
||||||
|
import org.assertj.core.api.InstanceOfAssertFactories;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
@ -165,7 +166,7 @@ class EndpointMBeanTests {
|
|||||||
new TestJmxOperation((arguments) -> Flux.just("flux", "result")));
|
new TestJmxOperation((arguments) -> Flux.just("flux", "result")));
|
||||||
EndpointMBean bean = new EndpointMBean(this.responseMapper, null, endpoint);
|
EndpointMBean bean = new EndpointMBean(this.responseMapper, null, endpoint);
|
||||||
Object result = bean.invoke("testOperation", NO_PARAMS, NO_SIGNATURE);
|
Object result = bean.invoke("testOperation", NO_PARAMS, NO_SIGNATURE);
|
||||||
assertThat(result).asList().containsExactly("flux", "result");
|
assertThat(result).asInstanceOf(InstanceOfAssertFactories.LIST).containsExactly("flux", "result");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -83,7 +83,7 @@ class CouchbaseAutoConfigurationTests {
|
|||||||
.doesNotHaveBean(PropertiesCouchbaseConnectionDetails.class);
|
.doesNotHaveBean(PropertiesCouchbaseConnectionDetails.class);
|
||||||
Cluster cluster = context.getBean(Cluster.class);
|
Cluster cluster = context.getBean(Cluster.class);
|
||||||
assertThat(cluster.core()).extracting("connectionString.hosts")
|
assertThat(cluster.core()).extracting("connectionString.hosts")
|
||||||
.asList()
|
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||||
.extractingResultOf("host")
|
.extractingResultOf("host")
|
||||||
.containsExactly("couchbase.example.com");
|
.containsExactly("couchbase.example.com");
|
||||||
});
|
});
|
||||||
@ -109,7 +109,7 @@ class CouchbaseAutoConfigurationTests {
|
|||||||
assertThat(context).hasSingleBean(ClusterEnvironment.class).hasSingleBean(Cluster.class);
|
assertThat(context).hasSingleBean(ClusterEnvironment.class).hasSingleBean(Cluster.class);
|
||||||
Cluster cluster = context.getBean(Cluster.class);
|
Cluster cluster = context.getBean(Cluster.class);
|
||||||
assertThat(cluster.core()).extracting("connectionString.hosts")
|
assertThat(cluster.core()).extracting("connectionString.hosts")
|
||||||
.asList()
|
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||||
.extractingResultOf("host")
|
.extractingResultOf("host")
|
||||||
.containsExactly("couchbase.example.com");
|
.containsExactly("couchbase.example.com");
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -126,7 +126,9 @@ class GraphQlAutoConfigurationTests {
|
|||||||
assertThat(graphQL.getQueryStrategy()).extracting("dataFetcherExceptionHandler")
|
assertThat(graphQL.getQueryStrategy()).extracting("dataFetcherExceptionHandler")
|
||||||
.satisfies((exceptionHandler) -> {
|
.satisfies((exceptionHandler) -> {
|
||||||
assertThat(exceptionHandler.getClass().getName()).endsWith("ExceptionResolversExceptionHandler");
|
assertThat(exceptionHandler.getClass().getName()).endsWith("ExceptionResolversExceptionHandler");
|
||||||
assertThat(exceptionHandler).extracting("resolvers").asList().hasSize(2);
|
assertThat(exceptionHandler).extracting("resolvers")
|
||||||
|
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||||
|
.hasSize(2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -28,6 +28,7 @@ import org.apache.kafka.streams.StreamsBuilder;
|
|||||||
import org.apache.kafka.streams.kstream.KStream;
|
import org.apache.kafka.streams.kstream.KStream;
|
||||||
import org.apache.kafka.streams.kstream.KTable;
|
import org.apache.kafka.streams.kstream.KTable;
|
||||||
import org.apache.kafka.streams.kstream.Materialized;
|
import org.apache.kafka.streams.kstream.Materialized;
|
||||||
|
import org.assertj.core.api.InstanceOfAssertFactories;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.condition.DisabledOnOs;
|
import org.junit.jupiter.api.condition.DisabledOnOs;
|
||||||
@ -115,7 +116,7 @@ class KafkaAutoConfigurationIntegrationTests {
|
|||||||
assertThat(listener).extracting(RetryListener::getKey, RetryListener::getReceived)
|
assertThat(listener).extracting(RetryListener::getKey, RetryListener::getReceived)
|
||||||
.containsExactly("foo", "bar");
|
.containsExactly("foo", "bar");
|
||||||
assertThat(listener).extracting(RetryListener::getTopics)
|
assertThat(listener).extracting(RetryListener::getTopics)
|
||||||
.asList()
|
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||||
.hasSize(5)
|
.hasSize(5)
|
||||||
.containsSequence("testRetryTopic", "testRetryTopic-retry-0", "testRetryTopic-retry-1",
|
.containsSequence("testRetryTopic", "testRetryTopic-retry-0", "testRetryTopic-retry-1",
|
||||||
"testRetryTopic-retry-2");
|
"testRetryTopic-retry-2");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -27,6 +27,7 @@ import org.apache.pulsar.client.api.PulsarClient;
|
|||||||
import org.apache.pulsar.client.api.ReaderBuilder;
|
import org.apache.pulsar.client.api.ReaderBuilder;
|
||||||
import org.apache.pulsar.client.api.interceptor.ProducerInterceptor;
|
import org.apache.pulsar.client.api.interceptor.ProducerInterceptor;
|
||||||
import org.apache.pulsar.common.schema.SchemaType;
|
import org.apache.pulsar.common.schema.SchemaType;
|
||||||
|
import org.assertj.core.api.InstanceOfAssertFactories;
|
||||||
import org.junit.jupiter.api.Nested;
|
import org.junit.jupiter.api.Nested;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.condition.EnabledForJreRange;
|
import org.junit.jupiter.api.condition.EnabledForJreRange;
|
||||||
@ -287,7 +288,7 @@ class PulsarAutoConfigurationTests {
|
|||||||
this.contextRunner.withBean("customProducerInterceptor", ProducerInterceptor.class, () -> interceptor)
|
this.contextRunner.withBean("customProducerInterceptor", ProducerInterceptor.class, () -> interceptor)
|
||||||
.run((context) -> assertThat(context).getBean(PulsarTemplate.class)
|
.run((context) -> assertThat(context).getBean(PulsarTemplate.class)
|
||||||
.extracting("interceptors")
|
.extracting("interceptors")
|
||||||
.asList()
|
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||||
.contains(interceptor));
|
.contains(interceptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,7 +297,7 @@ class PulsarAutoConfigurationTests {
|
|||||||
this.contextRunner.withUserConfiguration(InterceptorTestConfiguration.class)
|
this.contextRunner.withUserConfiguration(InterceptorTestConfiguration.class)
|
||||||
.run((context) -> assertThat(context).getBean(PulsarTemplate.class)
|
.run((context) -> assertThat(context).getBean(PulsarTemplate.class)
|
||||||
.extracting("interceptors")
|
.extracting("interceptors")
|
||||||
.asList()
|
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||||
.containsExactly(context.getBean("interceptorBar"), context.getBean("interceptorFoo")));
|
.containsExactly(context.getBean("interceptorBar"), context.getBean("interceptorFoo")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -424,7 +424,7 @@ class OAuth2ResourceServerAutoConfigurationTests {
|
|||||||
assertThat(context).hasSingleBean(OpaqueTokenIntrospector.class);
|
assertThat(context).hasSingleBean(OpaqueTokenIntrospector.class);
|
||||||
assertThat(context).hasSingleBean(JwtDecoder.class);
|
assertThat(context).hasSingleBean(JwtDecoder.class);
|
||||||
assertThat(getBearerTokenFilter(context)).extracting("authenticationManagerResolver.arg$1.providers")
|
assertThat(getBearerTokenFilter(context)).extracting("authenticationManagerResolver.arg$1.providers")
|
||||||
.asList()
|
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||||
.hasAtLeastOneElementOfType(JwtAuthenticationProvider.class);
|
.hasAtLeastOneElementOfType(JwtAuthenticationProvider.class);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -18,6 +18,7 @@ package org.springframework.boot.autoconfigure.transaction;
|
|||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
|
import org.assertj.core.api.InstanceOfAssertFactories;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||||
@ -42,7 +43,7 @@ class TransactionManagerCustomizationAutoConfigurationTests {
|
|||||||
this.contextRunner.run((context) -> {
|
this.contextRunner.run((context) -> {
|
||||||
TransactionManagerCustomizers customizers = context.getBean(TransactionManagerCustomizers.class);
|
TransactionManagerCustomizers customizers = context.getBean(TransactionManagerCustomizers.class);
|
||||||
assertThat(customizers).extracting("customizers")
|
assertThat(customizers).extracting("customizers")
|
||||||
.asList()
|
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||||
.hasSize(2)
|
.hasSize(2)
|
||||||
.hasAtLeastOneElementOfType(TransactionProperties.class)
|
.hasAtLeastOneElementOfType(TransactionProperties.class)
|
||||||
.hasAtLeastOneElementOfType(ExecutionListenersTransactionManagerCustomizer.class);
|
.hasAtLeastOneElementOfType(ExecutionListenersTransactionManagerCustomizer.class);
|
||||||
@ -54,7 +55,9 @@ class TransactionManagerCustomizationAutoConfigurationTests {
|
|||||||
this.contextRunner.withUserConfiguration(CustomTransactionManagerCustomizersConfiguration.class)
|
this.contextRunner.withUserConfiguration(CustomTransactionManagerCustomizersConfiguration.class)
|
||||||
.run((context) -> {
|
.run((context) -> {
|
||||||
TransactionManagerCustomizers customizers = context.getBean(TransactionManagerCustomizers.class);
|
TransactionManagerCustomizers customizers = context.getBean(TransactionManagerCustomizers.class);
|
||||||
assertThat(customizers).extracting("customizers").asList().isEmpty();
|
assertThat(customizers).extracting("customizers")
|
||||||
|
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||||
|
.isEmpty();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -198,7 +198,9 @@ class WebFluxAutoConfigurationTests {
|
|||||||
SimpleUrlHandlerMapping hm = context.getBean("resourceHandlerMapping", SimpleUrlHandlerMapping.class);
|
SimpleUrlHandlerMapping hm = context.getBean("resourceHandlerMapping", SimpleUrlHandlerMapping.class);
|
||||||
assertThat(hm.getUrlMap().get("/static/**")).isInstanceOf(ResourceWebHandler.class);
|
assertThat(hm.getUrlMap().get("/static/**")).isInstanceOf(ResourceWebHandler.class);
|
||||||
ResourceWebHandler staticHandler = (ResourceWebHandler) hm.getUrlMap().get("/static/**");
|
ResourceWebHandler staticHandler = (ResourceWebHandler) hm.getUrlMap().get("/static/**");
|
||||||
assertThat(staticHandler).extracting("locationValues").asList().hasSize(4);
|
assertThat(staticHandler).extracting("locationValues")
|
||||||
|
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||||
|
.hasSize(4);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -599,7 +601,7 @@ class WebFluxAutoConfigurationTests {
|
|||||||
.withBean(LowPrecedenceConfigurer.class, LowPrecedenceConfigurer::new)
|
.withBean(LowPrecedenceConfigurer.class, LowPrecedenceConfigurer::new)
|
||||||
.run((context) -> assertThat(context.getBean(DelegatingWebFluxConfiguration.class))
|
.run((context) -> assertThat(context.getBean(DelegatingWebFluxConfiguration.class))
|
||||||
.extracting("configurers.delegates")
|
.extracting("configurers.delegates")
|
||||||
.asList()
|
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||||
.extracting((configurer) -> (Class) configurer.getClass())
|
.extracting((configurer) -> (Class) configurer.getClass())
|
||||||
.containsExactly(HighPrecedenceConfigurer.class, WebFluxConfig.class, LowPrecedenceConfigurer.class));
|
.containsExactly(HighPrecedenceConfigurer.class, WebFluxConfig.class, LowPrecedenceConfigurer.class));
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -28,6 +28,7 @@ import java.util.LinkedHashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.assertj.core.api.InstanceOfAssertFactories;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.io.TempDir;
|
import org.junit.jupiter.api.io.TempDir;
|
||||||
|
|
||||||
@ -152,7 +153,7 @@ abstract class AbstractJsonMarshalTesterTests {
|
|||||||
void parseListShouldReturnContent() throws Exception {
|
void parseListShouldReturnContent() throws Exception {
|
||||||
ResolvableType type = ResolvableTypes.get("listOfExampleObject");
|
ResolvableType type = ResolvableTypes.get("listOfExampleObject");
|
||||||
AbstractJsonMarshalTester<Object> tester = createTester(type);
|
AbstractJsonMarshalTester<Object> tester = createTester(type);
|
||||||
assertThat(tester.parse(ARRAY_JSON)).asList().containsOnly(OBJECT);
|
assertThat(tester.parse(ARRAY_JSON)).asInstanceOf(InstanceOfAssertFactories.LIST).containsOnly(OBJECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -21,6 +21,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import org.assertj.core.api.InstanceOfAssertFactories;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ class GsonTesterIntegrationTests {
|
|||||||
@Test
|
@Test
|
||||||
void typicalListTest() throws Exception {
|
void typicalListTest() throws Exception {
|
||||||
String example = "[" + JSON + "]";
|
String example = "[" + JSON + "]";
|
||||||
assertThat(this.listJson.parse(example)).asList().hasSize(1);
|
assertThat(this.listJson.parse(example)).asInstanceOf(InstanceOfAssertFactories.LIST).hasSize(1);
|
||||||
assertThat(this.listJson.parse(example).getObject().get(0).getName()).isEqualTo("Spring");
|
assertThat(this.listJson.parse(example).getObject().get(0).getName()).isEqualTo("Spring");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import com.fasterxml.jackson.databind.MapperFeature;
|
import com.fasterxml.jackson.databind.MapperFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.json.JsonMapper;
|
import com.fasterxml.jackson.databind.json.JsonMapper;
|
||||||
|
import org.assertj.core.api.InstanceOfAssertFactories;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.springframework.core.io.ByteArrayResource;
|
import org.springframework.core.io.ByteArrayResource;
|
||||||
@ -63,7 +64,7 @@ class JacksonTesterIntegrationTests {
|
|||||||
void typicalListTest() throws Exception {
|
void typicalListTest() throws Exception {
|
||||||
JacksonTester.initFields(this, new ObjectMapper());
|
JacksonTester.initFields(this, new ObjectMapper());
|
||||||
String example = "[" + JSON + "]";
|
String example = "[" + JSON + "]";
|
||||||
assertThat(this.listJson.parse(example)).asList().hasSize(1);
|
assertThat(this.listJson.parse(example)).asInstanceOf(InstanceOfAssertFactories.LIST).hasSize(1);
|
||||||
assertThat(this.listJson.parse(example).getObject().get(0).getName()).isEqualTo("Spring");
|
assertThat(this.listJson.parse(example).getObject().get(0).getName()).isEqualTo("Spring");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -27,6 +27,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import org.assertj.core.api.InstanceOfAssertFactories;
|
||||||
import org.junit.jupiter.api.Disabled;
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.TestInfo;
|
import org.junit.jupiter.api.TestInfo;
|
||||||
@ -354,7 +355,7 @@ class ConfigDataEnvironmentTests {
|
|||||||
TestConfigDataEnvironment configDataEnvironment = new TestConfigDataEnvironment(this.logFactory,
|
TestConfigDataEnvironment configDataEnvironment = new TestConfigDataEnvironment(this.logFactory,
|
||||||
this.bootstrapContext, this.environment, resourceLoader, this.additionalProfiles, null);
|
this.bootstrapContext, this.environment, resourceLoader, this.additionalProfiles, null);
|
||||||
assertThat(configDataEnvironment).extracting("loaders.loaders")
|
assertThat(configDataEnvironment).extracting("loaders.loaders")
|
||||||
.asList()
|
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||||
.extracting((item) -> (Class) item.getClass())
|
.extracting((item) -> (Class) item.getClass())
|
||||||
.containsOnly(SeparateClassLoaderConfigDataLoader.class);
|
.containsOnly(SeparateClassLoaderConfigDataLoader.class);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -23,6 +23,7 @@ import java.util.List;
|
|||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.assertj.core.api.InstanceOfAssertFactories;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.io.TempDir;
|
import org.junit.jupiter.api.io.TempDir;
|
||||||
|
|
||||||
@ -65,7 +66,7 @@ class ConfigDataLoadersTests {
|
|||||||
ConfigDataLoaders loaders = new ConfigDataLoaders(this.logFactory, this.bootstrapContext,
|
ConfigDataLoaders loaders = new ConfigDataLoaders(this.logFactory, this.bootstrapContext,
|
||||||
springFactoriesLoader);
|
springFactoriesLoader);
|
||||||
assertThat(loaders).extracting("loaders")
|
assertThat(loaders).extracting("loaders")
|
||||||
.asList()
|
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||||
.satisfies(this::containsValidDeferredLogFactoryConfigDataLoader);
|
.satisfies(this::containsValidDeferredLogFactoryConfigDataLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -21,6 +21,7 @@ import java.nio.charset.StandardCharsets;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.assertj.core.api.InstanceOfAssertFactories;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.springframework.util.StreamUtils;
|
import org.springframework.util.StreamUtils;
|
||||||
@ -105,7 +106,7 @@ abstract class AbstractJsonParserTests {
|
|||||||
.parseMap("{\"foo\":[{\"foo\":\"bar\",\"spam\":1},{\"foo\":\"baz\",\"spam\":2}]}");
|
.parseMap("{\"foo\":[{\"foo\":\"bar\",\"spam\":1},{\"foo\":\"baz\",\"spam\":2}]}");
|
||||||
assertThat(map).hasSize(1);
|
assertThat(map).hasSize(1);
|
||||||
assertThat(((List<Object>) map.get("foo"))).hasSize(2);
|
assertThat(((List<Object>) map.get("foo"))).hasSize(2);
|
||||||
assertThat(map.get("foo")).asList().allMatch(Map.class::isInstance);
|
assertThat(map.get("foo")).asInstanceOf(InstanceOfAssertFactories.LIST).allMatch(Map.class::isInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -115,7 +116,7 @@ abstract class AbstractJsonParserTests {
|
|||||||
.parseMap(" {\"foo\": [ { \"foo\" : \"bar\" , \"spam\" : 1 } , { \"foo\" : \"baz\" , \"spam\" : 2 } ] } ");
|
.parseMap(" {\"foo\": [ { \"foo\" : \"bar\" , \"spam\" : 1 } , { \"foo\" : \"baz\" , \"spam\" : 2 } ] } ");
|
||||||
assertThat(map).hasSize(1);
|
assertThat(map).hasSize(1);
|
||||||
assertThat(((List<Object>) map.get("foo"))).hasSize(2);
|
assertThat(((List<Object>) map.get("foo"))).hasSize(2);
|
||||||
assertThat(map.get("foo")).asList().allMatch(Map.class::isInstance);
|
assertThat(map.get("foo")).asInstanceOf(InstanceOfAssertFactories.LIST).allMatch(Map.class::isInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user