From 1f4c6de287d3022c058d8dbf5a0713f11a69671e Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 23 Nov 2016 21:10:01 +0100 Subject: [PATCH] Polishing --- .../jmx/support/ConnectorServerFactoryBean.java | 1 - .../jdbc/core/AbstractRowMapperTests.java | 3 ++- .../codec/ServerSentEventHttpMessageWriterTests.java | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/jmx/support/ConnectorServerFactoryBean.java b/spring-context/src/main/java/org/springframework/jmx/support/ConnectorServerFactoryBean.java index d8ceaa847d..8e74355ca2 100644 --- a/spring-context/src/main/java/org/springframework/jmx/support/ConnectorServerFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/jmx/support/ConnectorServerFactoryBean.java @@ -49,7 +49,6 @@ import org.springframework.util.CollectionUtils; * @author Rob Harrop * @author Juergen Hoeller * @since 1.2 - * @see FactoryBean * @see JMXConnectorServer * @see MBeanServer */ diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/AbstractRowMapperTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/AbstractRowMapperTests.java index 2ad750cfea..03ec8451b0 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/AbstractRowMapperTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/AbstractRowMapperTests.java @@ -90,6 +90,7 @@ public abstract class AbstractRowMapperTests { this(MockType.ONE); } + @SuppressWarnings("unchecked") public Mock(MockType type) throws Exception { connection = mock(Connection.class); statement = mock(Statement.class); @@ -107,7 +108,7 @@ public abstract class AbstractRowMapperTests { given(resultSet.getObject(anyInt(), any(Class.class))).willThrow(new SQLFeatureNotSupportedException()); given(resultSet.getDate(3)).willReturn(new java.sql.Date(1221222L)); given(resultSet.getBigDecimal(4)).willReturn(new BigDecimal("1234.56")); - given(resultSet.wasNull()).willReturn(type == MockType.TWO ? true : false); + given(resultSet.wasNull()).willReturn(type == MockType.TWO); given(resultSetMetaData.getColumnCount()).willReturn(4); given(resultSetMetaData.getColumnLabel(1)).willReturn( diff --git a/spring-web/src/test/java/org/springframework/http/codec/ServerSentEventHttpMessageWriterTests.java b/spring-web/src/test/java/org/springframework/http/codec/ServerSentEventHttpMessageWriterTests.java index d18fc2b460..ecc0fb564d 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/ServerSentEventHttpMessageWriterTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/ServerSentEventHttpMessageWriterTests.java @@ -33,8 +33,7 @@ import org.springframework.http.MediaType; import org.springframework.http.codec.json.Jackson2JsonEncoder; import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; /** * @author Sebastien Deleuze @@ -64,9 +63,10 @@ public class ServerSentEventHttpMessageWriterTests extends AbstractDataBufferAll @Test public void encodeServerSentEvent() { - ServerSentEvent - event = ServerSentEvent.builder().data("bar").id("c42").event("foo").comment("bla\nbla bla\nbla bla bla") + ServerSentEvent event = ServerSentEvent.builder(). + data("bar").id("c42").event("foo").comment("bla\nbla bla\nbla bla bla") .retry(Duration.ofMillis(123L)).build(); + Mono> source = Mono.just(event); MockServerHttpResponse outputMessage = new MockServerHttpResponse(); messageWriter.write(source, ResolvableType.forClass(ServerSentEvent.class), @@ -126,9 +126,10 @@ public class ServerSentEventHttpMessageWriterTests extends AbstractDataBufferAll .verify(); } + private Consumer> sseConsumer(String... expected) { return publisher -> { - StepVerifier.Step builder = StepVerifier.create(publisher); + StepVerifier.Step builder = StepVerifier.create(publisher); for (String value : expected) { builder = builder.consumeNextWith(stringConsumer(value)); }