From 8eb9782ca205b87b06511427a1baabe16b2df983 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 7 May 2019 12:43:36 +0200 Subject: [PATCH] Polishing --- .../annotation/MissingMergedAnnotationTests.java | 15 +++++++++------ .../DefaultRSocketRequesterBuilderTests.java | 10 ++++++---- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/spring-core/src/test/java/org/springframework/core/annotation/MissingMergedAnnotationTests.java b/spring-core/src/test/java/org/springframework/core/annotation/MissingMergedAnnotationTests.java index d5c042666c..045483cedd 100644 --- a/spring-core/src/test/java/org/springframework/core/annotation/MissingMergedAnnotationTests.java +++ b/spring-core/src/test/java/org/springframework/core/annotation/MissingMergedAnnotationTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -38,9 +38,10 @@ public class MissingMergedAnnotationTests { private final MergedAnnotation missing = MissingMergedAnnotation.getInstance(); + @Test public void getTypeThrowsNoSuchElementException() { - assertThatNoSuchElementException().isThrownBy(() -> this.missing.getType()); + assertThatNoSuchElementException().isThrownBy(this.missing::getType); } @Test @@ -288,17 +289,19 @@ public class MissingMergedAnnotationTests { assertThat(map).isInstanceOf(ConcurrentReferenceHashMap.class); } + private static ThrowableTypeAssert assertThatNoSuchElementException() { return assertThatExceptionOfType(NoSuchElementException.class); } - private static enum TestEnum { + + private enum TestEnum { ONE, TWO, THREE } - @Retention(RetentionPolicy.RUNTIME) - private static @interface TestAnnotation { + @Retention(RetentionPolicy.RUNTIME) + private @interface TestAnnotation { } } diff --git a/spring-messaging/src/test/java/org/springframework/messaging/rsocket/DefaultRSocketRequesterBuilderTests.java b/spring-messaging/src/test/java/org/springframework/messaging/rsocket/DefaultRSocketRequesterBuilderTests.java index fa2393c13d..80816e7369 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/rsocket/DefaultRSocketRequesterBuilderTests.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/rsocket/DefaultRSocketRequesterBuilderTests.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -47,8 +47,9 @@ public class DefaultRSocketRequesterBuilderTests { when(this.transport.connect(anyInt())).thenReturn(Mono.just(new MockConnection())); } - @SuppressWarnings("unchecked") + @Test + @SuppressWarnings("unchecked") public void shouldApplyCustomizationsAtSubscription() { Consumer factoryConfigurer = mock(Consumer.class); Consumer strategiesConfigurer = mock(Consumer.class); @@ -59,8 +60,8 @@ public class DefaultRSocketRequesterBuilderTests { verifyZeroInteractions(this.transport, factoryConfigurer, strategiesConfigurer); } - @SuppressWarnings("unchecked") @Test + @SuppressWarnings("unchecked") public void shouldApplyCustomizations() { Consumer factoryConfigurer = mock(Consumer.class); Consumer strategiesConfigurer = mock(Consumer.class); @@ -74,6 +75,7 @@ public class DefaultRSocketRequesterBuilderTests { verify(strategiesConfigurer).accept(any(RSocketStrategies.Builder.class)); } + static class MockConnection implements DuplexConnection { @Override @@ -97,4 +99,4 @@ public class DefaultRSocketRequesterBuilderTests { } } -} \ No newline at end of file +}