Discontinue use of JUnit 3 APIs

This commit also ensures that the JSR-330 TCK is executed with the
normal build by adhering to naming conventions for test classes.

See gh-22894
This commit is contained in:
Sam Brannen 2019-05-12 14:46:25 +02:00
parent 5685e9dfa3
commit 724c805211
10 changed files with 22 additions and 18 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2009 the original author or authors. * Copyright 2002-2019 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.
@ -38,8 +38,9 @@ import org.springframework.context.support.GenericApplicationContext;
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 3.0 * @since 3.0
*/ */
public class SpringAtInjectTck { public class SpringAtInjectTckTests {
@SuppressWarnings("unchecked")
public static Test suite() { public static Test suite() {
GenericApplicationContext ac = new GenericApplicationContext(); GenericApplicationContext ac = new GenericApplicationContext();
AnnotatedBeanDefinitionReader bdr = new AnnotatedBeanDefinitionReader(ac); AnnotatedBeanDefinitionReader bdr = new AnnotatedBeanDefinitionReader(ac);

View File

@ -1,5 +1,5 @@
/* /*
* 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"); * 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.
@ -30,8 +30,8 @@ import org.springframework.http.HttpStatus;
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse;
import static junit.framework.TestCase.assertFalse;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
@ -42,7 +42,6 @@ import static org.junit.Assert.fail;
*/ */
public class ContextPathCompositeHandlerTests { public class ContextPathCompositeHandlerTests {
@Test @Test
public void invalidContextPath() { public void invalidContextPath() {
testInvalid(" ", "Context path must not be empty"); testInvalid(" ", "Context path must not be empty");

View File

@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.http.server.reactive; package org.springframework.http.server.reactive;
import java.io.IOException; import java.io.IOException;
@ -26,9 +27,9 @@ import org.reactivestreams.Subscription;
import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBuffer;
import static junit.framework.TestCase.assertEquals; import static org.junit.Assert.assertEquals;
import static junit.framework.TestCase.assertNotNull; import static org.junit.Assert.assertNotNull;
import static junit.framework.TestCase.assertSame; import static org.junit.Assert.assertSame;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* 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"); * 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.
@ -32,10 +32,10 @@ import org.springframework.core.io.buffer.DefaultDataBufferFactory;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseCookie; import org.springframework.http.ResponseCookie;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame; import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
/** /**
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
@ -43,7 +43,6 @@ import static org.junit.Assert.assertSame;
*/ */
public class ServerHttpResponseTests { public class ServerHttpResponseTests {
@Test @Test
public void writeWith() throws Exception { public void writeWith() throws Exception {
TestServerHttpResponse response = new TestServerHttpResponse(); TestServerHttpResponse response = new TestServerHttpResponse();

View File

@ -41,9 +41,9 @@ import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebExchange;
import static junit.framework.TestCase.assertFalse;
import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.springframework.core.ResolvableType.forClass; import static org.springframework.core.ResolvableType.forClass;

View File

@ -1,5 +1,5 @@
/* /*
* 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"); * 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.
@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.server.session; package org.springframework.web.server.session;
import java.time.Clock; import java.time.Clock;
@ -26,10 +27,10 @@ import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor; import org.springframework.beans.DirectFieldAccessor;
import org.springframework.web.server.WebSession; import org.springframework.web.server.WebSession;
import static junit.framework.TestCase.assertSame;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;

View File

@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.util; package org.springframework.web.util;
import java.net.URI; import java.net.URI;
@ -24,7 +25,7 @@ import org.junit.Test;
import org.springframework.web.util.DefaultUriBuilderFactory.EncodingMode; import org.springframework.web.util.DefaultUriBuilderFactory.EncodingMode;
import static java.util.Collections.singletonMap; import static java.util.Collections.singletonMap;
import static junit.framework.TestCase.assertEquals; import static org.junit.Assert.assertEquals;
/** /**
* Unit tests for {@link DefaultUriBuilderFactory}. * Unit tests for {@link DefaultUriBuilderFactory}.

View File

@ -38,11 +38,10 @@ import org.springframework.mock.web.test.server.MockServerWebExchange;
import org.springframework.ui.ExtendedModelMap; import org.springframework.ui.ExtendedModelMap;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
/** /**
* Unit tests for {@link HttpMessageWriterView}. * Unit tests for {@link HttpMessageWriterView}.
* @author Rossen Stoyanchev * @author Rossen Stoyanchev

View File

@ -54,9 +54,9 @@ import org.springframework.web.context.request.async.WebAsyncUtils;
import org.springframework.web.method.support.ModelAndViewContainer; import org.springframework.web.method.support.ModelAndViewContainer;
import org.springframework.web.servlet.HandlerMapping; import org.springframework.web.servlet.HandlerMapping;
import static junit.framework.TestCase.assertNull;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.springframework.core.ResolvableType.forClass; import static org.springframework.core.ResolvableType.forClass;
import static org.springframework.web.method.ResolvableMethod.on; import static org.springframework.web.method.ResolvableMethod.on;

View File

@ -14,6 +14,9 @@
<suppress files="GenericBeanDefinition" checks="EqualsHashCode" /> <suppress files="GenericBeanDefinition" checks="EqualsHashCode" />
<suppress files="RootBeanDefinition" checks="EqualsHashCode" /> <suppress files="RootBeanDefinition" checks="EqualsHashCode" />
<!-- spring-context -->
<suppress files="SpringAtInjectTckTests" checks="IllegalImportCheck" />
<!-- spring-core --> <!-- spring-core -->
<suppress files="[\\/]src[\\/]main[\\/]java[\\/]org[\\/]springframework[\\/]asm[\\/]" checks=".*" /> <suppress files="[\\/]src[\\/]main[\\/]java[\\/]org[\\/]springframework[\\/]asm[\\/]" checks=".*" />
<suppress files="[\\/]src[\\/]main[\\/]java[\\/]org[\\/]springframework[\\/]cglib[\\/]" checks=".*" /> <suppress files="[\\/]src[\\/]main[\\/]java[\\/]org[\\/]springframework[\\/]cglib[\\/]" checks=".*" />