Merge pull request #29157 from izeye

* pr/29157:
  Polish

Closes gh-29157
pull/30003/head
Stephane Nicoll 3 years ago
commit 576eb50ed8

@ -56,7 +56,7 @@ class StackdriverPropertiesConfigAdapterTests {
}
@Test
void whenPropertiesUseSemanticMetricTypesIsSetAdapterResourceTypeReturnsIt() {
void whenPropertiesUseSemanticMetricTypesIsSetAdapterUseSemanticMetricTypesReturnsIt() {
StackdriverProperties properties = new StackdriverProperties();
properties.setUseSemanticMetricTypes(true);
assertThat(new StackdriverPropertiesConfigAdapter(properties).useSemanticMetricTypes()).isTrue();

@ -234,32 +234,32 @@ class CachingOperationInvokerTests {
given(target.invoke(contextV2)).willReturn(expectedV2);
given(target.invoke(contextV3)).willReturn(expectedV3);
CachingOperationInvoker invoker = new CachingOperationInvoker(target, CACHE_TTL);
Object response = invoker.invoke(contextV2);
assertThat(response).isSameAs(expectedV2);
Object responseV2 = invoker.invoke(contextV2);
assertThat(responseV2).isSameAs(expectedV2);
verify(target, times(1)).invoke(contextV2);
Object cachedResponse = invoker.invoke(contextV3);
assertThat(cachedResponse).isNotSameAs(response);
Object responseV3 = invoker.invoke(contextV3);
assertThat(responseV3).isNotSameAs(responseV2);
verify(target, times(1)).invoke(contextV3);
}
@Test
void targetInvokedWithDifferentWebServerNamespace() {
OperationInvoker target = mock(OperationInvoker.class);
Object expectedV2 = new Object();
Object expectedV3 = new Object();
InvocationContext contextV2 = new InvocationContext(mock(SecurityContext.class), Collections.emptyMap(),
Object expectedServer = new Object();
Object expectedManagement = new Object();
InvocationContext contextServer = new InvocationContext(mock(SecurityContext.class), Collections.emptyMap(),
new WebServerNamespaceArgumentResolver(WebServerNamespace.SERVER));
InvocationContext contextV3 = new InvocationContext(mock(SecurityContext.class), Collections.emptyMap(),
InvocationContext contextManagement = new InvocationContext(mock(SecurityContext.class), Collections.emptyMap(),
new WebServerNamespaceArgumentResolver(WebServerNamespace.MANAGEMENT));
given(target.invoke(contextV2)).willReturn(expectedV2);
given(target.invoke(contextV3)).willReturn(expectedV3);
given(target.invoke(contextServer)).willReturn(expectedServer);
given(target.invoke(contextManagement)).willReturn(expectedManagement);
CachingOperationInvoker invoker = new CachingOperationInvoker(target, CACHE_TTL);
Object response = invoker.invoke(contextV2);
assertThat(response).isSameAs(expectedV2);
verify(target, times(1)).invoke(contextV2);
Object cachedResponse = invoker.invoke(contextV3);
assertThat(cachedResponse).isNotSameAs(response);
verify(target, times(1)).invoke(contextV3);
Object responseServer = invoker.invoke(contextServer);
assertThat(responseServer).isSameAs(expectedServer);
verify(target, times(1)).invoke(contextServer);
Object responseManagement = invoker.invoke(contextManagement);
assertThat(responseManagement).isNotSameAs(responseServer);
verify(target, times(1)).invoke(contextManagement);
}
private static class MonoOperationInvoker implements OperationInvoker {

@ -45,7 +45,7 @@ class AbstractHealthIndicatorTests {
}
@Test
void healthCheckWhenDownWithExceptionThrownDoesNotLogHealthCheckFailedMessage(CapturedOutput output) {
void healthCheckWhenDownWithExceptionThrownLogsHealthCheckFailedMessage(CapturedOutput output) {
TestHealthIndicator indicator = new TestHealthIndicator("Test message", (builder) -> {
throw new IllegalStateException("Test exception");
});
@ -55,7 +55,7 @@ class AbstractHealthIndicatorTests {
}
@Test
void healthCheckWhenDownWithExceptionConfiguredDoesNotLogHealthCheckFailedMessage(CapturedOutput output) {
void healthCheckWhenDownWithExceptionConfiguredLogsHealthCheckFailedMessage(CapturedOutput output) {
Health heath = new TestHealthIndicator("Test message",
(builder) -> builder.down().withException(new IllegalStateException("Test exception"))).health();
assertThat(heath.getStatus()).isEqualTo(Status.DOWN);

@ -182,7 +182,7 @@ class WebMvcMetricsFilterTests {
@Test
void unhandledError() {
assertThatCode(() -> this.mvc.perform(get("/api/c1/unhandledError/10")).andExpect(status().isOk()))
assertThatCode(() -> this.mvc.perform(get("/api/c1/unhandledError/10")))
.hasRootCauseInstanceOf(RuntimeException.class);
assertThat(this.registry.get("http.server.requests").tags("exception", "RuntimeException").timer().count())
.isEqualTo(1L);
@ -191,8 +191,8 @@ class WebMvcMetricsFilterTests {
@Test
void unhandledServletException() {
assertThatCode(() -> this.mvc
.perform(get("/api/filterError").header(CustomBehaviorFilter.TEST_SERVLET_EXCEPTION_HEADER, "throw"))
.andExpect(status().isOk())).isInstanceOf(ServletException.class);
.perform(get("/api/filterError").header(CustomBehaviorFilter.TEST_SERVLET_EXCEPTION_HEADER, "throw")))
.isInstanceOf(ServletException.class);
Id meterId = this.registry.get("http.server.requests").tags("exception", "ServletException").timer().getId();
assertThat(meterId.getTag("status")).isEqualTo("500");
}
@ -372,7 +372,7 @@ class WebMvcMetricsFilterTests {
}
@Bean
CustomBehaviorFilter redirectAndNotFoundFilter() {
CustomBehaviorFilter customBehaviorFilter() {
return new CustomBehaviorFilter();
}

@ -85,7 +85,7 @@ class RabbitStreamConfigurationTests {
}
@Test
void whenCustomMessageListenerContainerIsDefinedThenAutoConfiguredContainerBacksOff() {
void whenCustomMessageListenerContainerFactoryIsDefinedThenAutoConfiguredContainerFactoryBacksOff() {
this.contextRunner.withUserConfiguration(CustomMessageListenerContainerFactoryConfiguration.class)
.run((context) -> {
assertThat(context).hasSingleBean(RabbitListenerContainerFactory.class);

@ -27,6 +27,7 @@ import io.rsocket.transport.ClientTransport;
import io.rsocket.transport.netty.client.TcpClientTransport;
import org.assertj.core.api.InstanceOfAssertFactories;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.boot.autoconfigure.AutoConfigurations;
@ -58,8 +59,10 @@ import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.config.IntegrationManagementConfigurer;
import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.endpoint.MessageProcessorMessageSource;
import org.springframework.integration.gateway.RequestReplyExchanger;
import org.springframework.integration.handler.MessageProcessor;
import org.springframework.integration.rsocket.ClientRSocketConnector;
import org.springframework.integration.rsocket.IntegrationRSocketEndpoint;
import org.springframework.integration.rsocket.ServerRSocketConnector;
@ -526,9 +529,8 @@ class IntegrationAutoConfigurationTests {
static class MessageSourceConfiguration {
@Bean
org.springframework.integration.core.MessageSource<?> myMessageSource() {
return new MessageProcessorMessageSource(
mock(org.springframework.integration.handler.MessageProcessor.class));
MessageSource<?> myMessageSource() {
return new MessageProcessorMessageSource(mock(MessageProcessor.class));
}
}
@ -541,7 +543,7 @@ class IntegrationAutoConfigurationTests {
return new IntegrationRSocketEndpoint() {
@Override
public reactor.core.publisher.Mono<Void> handleMessage(Message<?> message) {
public Mono<Void> handleMessage(Message<?> message) {
return null;
}

@ -11,6 +11,6 @@ For instance, the following service triggers the validation of the first argumen
include::{docs-java}/io/validation/MyBean.java[]
----
The application's `MessageSource` is used when resolving +`{parameters}`+ in constraint messages.
The application's `MessageSource` is used when resolving `+{parameters}+` in constraint messages.
This allows you to use <<features.adoc#features.internationalization,your application's `messages.properties` files>> for Bean Validation messages.
Once the parameters have been resolved, message interpolation is completed using Bean Validation's default interpolator.

@ -234,7 +234,7 @@ public class TestEntityManager {
*/
public final EntityManager getEntityManager() {
EntityManager manager = EntityManagerFactoryUtils.getTransactionalEntityManager(this.entityManagerFactory);
Assert.state(manager != null, "No transactional EntityManager found, is your test running in a transactional?");
Assert.state(manager != null, "No transactional EntityManager found, is your test running in a transaction?");
return manager;
}

@ -223,7 +223,7 @@ class ImportsContextCustomizer implements ContextCustomizer {
filters.add(new JavaLangAnnotationFilter());
filters.add(new KotlinAnnotationFilter());
filters.add(new SpockAnnotationFilter());
filters.add(new JunitAnnotationFilter());
filters.add(new JUnitAnnotationFilter());
ANNOTATION_FILTERS = Collections.unmodifiableSet(filters);
}
@ -389,7 +389,7 @@ class ImportsContextCustomizer implements ContextCustomizer {
/**
* {@link AnnotationFilter} for JUnit annotations.
*/
private static final class JunitAnnotationFilter implements AnnotationFilter {
private static final class JUnitAnnotationFilter implements AnnotationFilter {
@Override
public boolean isIgnored(Annotation annotation) {

@ -75,9 +75,9 @@ class ImportsContextCustomizerTests {
}
@Test
void customizersForTestClassesWithDifferentJunitAnnotationsAreEqual() {
assertThat(new ImportsContextCustomizer(FirstJunitAnnotatedTestClass.class))
.isEqualTo(new ImportsContextCustomizer(SecondJunitAnnotatedTestClass.class));
void customizersForTestClassesWithDifferentJUnitAnnotationsAreEqual() {
assertThat(new ImportsContextCustomizer(FirstJUnitAnnotatedTestClass.class))
.isEqualTo(new ImportsContextCustomizer(SecondJUnitAnnotatedTestClass.class));
}
@Import(TestImportSelector.class)
@ -142,13 +142,13 @@ class ImportsContextCustomizerTests {
@Nested
@Import(TestImportSelector.class)
static class FirstJunitAnnotatedTestClass {
static class FirstJUnitAnnotatedTestClass {
}
@Tag("test")
@Import(TestImportSelector.class)
static class SecondJunitAnnotatedTestClass {
static class SecondJUnitAnnotatedTestClass {
}

Loading…
Cancel
Save