diff --git a/build.gradle b/build.gradle index 33eb5ad829..356cae61fd 100644 --- a/build.gradle +++ b/build.gradle @@ -42,7 +42,7 @@ configure(allprojects) { project -> version = qualifyVersionIfNecessary(version) ext.aspectjVersion = "1.8.12" - ext.freemarkerVersion = "2.3.26-incubating" + ext.freemarkerVersion = "2.3.27-incubating" ext.groovyVersion = "2.4.12" ext.hsqldbVersion = "2.4.0" ext.jackson2Version = "2.9.2" @@ -132,7 +132,7 @@ configure(allprojects) { project -> testCompile("junit:junit:4.12") { exclude group:'org.hamcrest', module:'hamcrest-core' } - testCompile("org.mockito:mockito-core:2.6.1") { + testCompile("org.mockito:mockito-core:2.11.0") { exclude group:'org.hamcrest', module:'hamcrest-core' } testCompile("com.nhaarman:mockito-kotlin:1.5.0") { diff --git a/spring-aop/spring-aop.gradle b/spring-aop/spring-aop.gradle index a9dca5b8ad..344634f681 100644 --- a/spring-aop/spring-aop.gradle +++ b/spring-aop/spring-aop.gradle @@ -4,6 +4,6 @@ dependencies { compile(project(":spring-beans")) compile(project(':spring-core')) optional("org.aspectj:aspectjweaver:${aspectjVersion}") - optional("org.apache.commons:commons-pool2:2.4.2") + optional("org.apache.commons:commons-pool2:2.4.3") optional("com.jamonapi:jamon:2.81") } diff --git a/spring-context/spring-context.gradle b/spring-context/spring-context.gradle index b45a8dee62..62e0d88feb 100644 --- a/spring-context/spring-context.gradle +++ b/spring-context/spring-context.gradle @@ -23,7 +23,7 @@ dependencies { optional("org.hibernate:hibernate-validator:5.4.2.Final") optional("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}") optional("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}") - testCompile("org.apache.commons:commons-pool2:2.4.2") + testCompile("org.apache.commons:commons-pool2:2.4.3") testCompile("org.slf4j:slf4j-api:${slf4jVersion}") testCompile("javax.inject:javax.inject-tck:1") testRuntime("javax.xml.bind:jaxb-api:2.3.0") diff --git a/spring-core/src/main/java/org/springframework/core/io/ByteArrayResource.java b/spring-core/src/main/java/org/springframework/core/io/ByteArrayResource.java index e9f8f8b907..79415fa42c 100644 --- a/spring-core/src/main/java/org/springframework/core/io/ByteArrayResource.java +++ b/spring-core/src/main/java/org/springframework/core/io/ByteArrayResource.java @@ -48,7 +48,7 @@ public class ByteArrayResource extends AbstractResource { /** - * Create a new ByteArrayResource. + * Create a new {@code ByteArrayResource}. * @param byteArray the byte array to wrap */ public ByteArrayResource(byte[] byteArray) { @@ -56,7 +56,7 @@ public class ByteArrayResource extends AbstractResource { } /** - * Create a new ByteArrayResource. + * Create a new {@code ByteArrayResource} with a description. * @param byteArray the byte array to wrap * @param description where the byte array comes from */ @@ -66,6 +66,7 @@ public class ByteArrayResource extends AbstractResource { this.description = (description != null ? description : ""); } + /** * Return the underlying byte array. */ @@ -73,7 +74,6 @@ public class ByteArrayResource extends AbstractResource { return this.byteArray; } - /** * This implementation always returns {@code true}. */ diff --git a/spring-core/src/test/java/org/springframework/tests/MockitoUtils.java b/spring-core/src/test/java/org/springframework/tests/MockitoUtils.java index 53e0db27a2..b0b66bc777 100644 --- a/spring-core/src/test/java/org/springframework/tests/MockitoUtils.java +++ b/spring-core/src/test/java/org/springframework/tests/MockitoUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2017 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. @@ -19,6 +19,7 @@ package org.springframework.tests; import java.util.List; import org.mockito.Mockito; +import org.mockito.internal.stubbing.InvocationContainerImpl; import org.mockito.internal.util.MockUtil; import org.mockito.invocation.Invocation; @@ -40,8 +41,10 @@ public abstract class MockitoUtils { * @param argumentAdapters adapters that can be used to change argument values before they are compared */ public static void verifySameInvocations(T expected, T actual, InvocationArgumentsAdapter... argumentAdapters) { - List expectedInvocations = MockUtil.getMockHandler(expected).getInvocationContainer().getInvocations(); - List actualInvocations = MockUtil.getMockHandler(actual).getInvocationContainer().getInvocations(); + List expectedInvocations = + ((InvocationContainerImpl) MockUtil.getMockHandler(expected).getInvocationContainer()).getInvocations(); + List actualInvocations = + ((InvocationContainerImpl) MockUtil.getMockHandler(actual).getInvocationContainer()).getInvocations(); verifySameInvocations(expectedInvocations, actualInvocations, argumentAdapters); } diff --git a/spring-web/spring-web.gradle b/spring-web/spring-web.gradle index eefa9bb8f4..192ce33b66 100644 --- a/spring-web/spring-web.gradle +++ b/spring-web/spring-web.gradle @@ -87,6 +87,6 @@ dependencies { testRuntime("com.sun.mail:javax.mail:1.6.0") testRuntime("com.sun.xml.bind:jaxb-core:2.3.0") testRuntime("com.sun.xml.bind:jaxb-impl:2.3.0") - testRuntime("javax.json:javax.json-api:1.1") + testRuntime("javax.json:javax.json-api:1.1.2") testRuntime("org.apache.johnzon:johnzon-jsonb:1.1.4") } diff --git a/spring-web/src/test/java/org/springframework/http/HttpRangeTests.java b/spring-web/src/test/java/org/springframework/http/HttpRangeTests.java index 10121ef6ec..cc8787de46 100644 --- a/spring-web/src/test/java/org/springframework/http/HttpRangeTests.java +++ b/spring-web/src/test/java/org/springframework/http/HttpRangeTests.java @@ -39,57 +39,57 @@ import static org.mockito.BDDMockito.*; public class HttpRangeTests { @Test(expected = IllegalArgumentException.class) - public void invalidFirstPosition() throws Exception { + public void invalidFirstPosition() { HttpRange.createByteRange(-1); } @Test(expected = IllegalArgumentException.class) - public void invalidLastLessThanFirst() throws Exception { + public void invalidLastLessThanFirst() { HttpRange.createByteRange(10, 9); } @Test(expected = IllegalArgumentException.class) - public void invalidSuffixLength() throws Exception { + public void invalidSuffixLength() { HttpRange.createSuffixRange(-1); } @Test - public void byteRange() throws Exception { + public void byteRange() { HttpRange range = HttpRange.createByteRange(0, 499); assertEquals(0, range.getRangeStart(1000)); assertEquals(499, range.getRangeEnd(1000)); } @Test - public void byteRangeWithoutLastPosition() throws Exception { + public void byteRangeWithoutLastPosition() { HttpRange range = HttpRange.createByteRange(9500); assertEquals(9500, range.getRangeStart(10000)); assertEquals(9999, range.getRangeEnd(10000)); } @Test - public void byteRangeOfZeroLength() throws Exception { + public void byteRangeOfZeroLength() { HttpRange range = HttpRange.createByteRange(9500, 9500); assertEquals(9500, range.getRangeStart(10000)); assertEquals(9500, range.getRangeEnd(10000)); } @Test - public void suffixRange() throws Exception { + public void suffixRange() { HttpRange range = HttpRange.createSuffixRange(500); assertEquals(500, range.getRangeStart(1000)); assertEquals(999, range.getRangeEnd(1000)); } @Test - public void suffixRangeShorterThanRepresentation() throws Exception { + public void suffixRangeShorterThanRepresentation() { HttpRange range = HttpRange.createSuffixRange(500); assertEquals(0, range.getRangeStart(350)); assertEquals(349, range.getRangeEnd(350)); } @Test - public void parseRanges() throws Exception { + public void parseRanges() { List ranges = HttpRange.parseRanges("bytes=0-0,500-,-1"); assertEquals(3, ranges.size()); assertEquals(0, ranges.get(0).getRangeStart(1000)); @@ -137,8 +137,8 @@ public class HttpRangeTests { @Test(expected = IllegalArgumentException.class) @SuppressWarnings("unchecked") - public void toResourceRegionExceptionLength() { - ByteArrayResource resource = mock(ByteArrayResource.class); + public void toResourceRegionExceptionLength() throws IOException { + InputStreamResource resource = mock(InputStreamResource.class); given(resource.contentLength()).willThrow(IOException.class); HttpRange range = HttpRange.createByteRange(0, 9); range.toResourceRegion(resource); diff --git a/spring-web/src/test/java/org/springframework/web/client/HttpMessageConverterExtractorTests.java b/spring-web/src/test/java/org/springframework/web/client/HttpMessageConverterExtractorTests.java index 01eadffef9..1452d45d4a 100644 --- a/spring-web/src/test/java/org/springframework/web/client/HttpMessageConverterExtractorTests.java +++ b/spring-web/src/test/java/org/springframework/web/client/HttpMessageConverterExtractorTests.java @@ -167,7 +167,6 @@ public class HttpMessageConverterExtractorTests { given(converter.read(eq(type), eq(null), any(HttpInputMessage.class))).willReturn(expected); Object result = extractor.extractData(response); - assertEquals(expected, result); } @@ -182,7 +181,8 @@ public class HttpMessageConverterExtractorTests { given(response.getRawStatusCode()).willReturn(HttpStatus.OK.value()); given(response.getHeaders()).willReturn(responseHeaders); given(response.getBody()).willReturn(new ByteArrayInputStream("Foobar".getBytes())); - given(converter.canRead(String.class, contentType)).willThrow(IOException.class); + given(converter.canRead(String.class, contentType)).willReturn(true); + given(converter.read(eq(String.class), any(HttpInputMessage.class))).willThrow(IOException.class); exception.expect(RestClientException.class); exception.expectMessage("Error while extracting response for type " + "[class java.lang.String] and content type [text/plain]");