Browse Source

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
pull/22953/head
Sam Brannen 6 years ago
parent
commit
724c805211
  1. 5
      spring-context/src/test/java/org/springframework/context/annotation/jsr330/SpringAtInjectTckTests.java
  2. 5
      spring-web/src/test/java/org/springframework/http/server/reactive/ContextPathCompositeHandlerTests.java
  3. 7
      spring-web/src/test/java/org/springframework/http/server/reactive/ListenerWriteProcessorTests.java
  4. 5
      spring-web/src/test/java/org/springframework/http/server/reactive/ServerHttpResponseTests.java
  5. 2
      spring-web/src/test/java/org/springframework/web/bind/support/WebExchangeDataBinderTests.java
  6. 5
      spring-web/src/test/java/org/springframework/web/server/session/InMemoryWebSessionStoreTests.java
  7. 3
      spring-web/src/test/java/org/springframework/web/util/DefaultUriBuilderFactoryTests.java
  8. 3
      spring-webflux/src/test/java/org/springframework/web/reactive/result/view/HttpMessageWriterViewTests.java
  9. 2
      spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ReactiveTypeHandlerTests.java
  10. 3
      src/checkstyle/checkstyle-suppressions.xml

5
spring-context/src/test/java/org/springframework/context/annotation/jsr330/SpringAtInjectTck.java → spring-context/src/test/java/org/springframework/context/annotation/jsr330/SpringAtInjectTckTests.java

@ -1,5 +1,5 @@ @@ -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");
* you may not use this file except in compliance with the License.
@ -38,8 +38,9 @@ import org.springframework.context.support.GenericApplicationContext; @@ -38,8 +38,9 @@ import org.springframework.context.support.GenericApplicationContext;
* @author Juergen Hoeller
* @since 3.0
*/
public class SpringAtInjectTck {
public class SpringAtInjectTckTests {
@SuppressWarnings("unchecked")
public static Test suite() {
GenericApplicationContext ac = new GenericApplicationContext();
AnnotatedBeanDefinitionReader bdr = new AnnotatedBeanDefinitionReader(ac);

5
spring-web/src/test/java/org/springframework/http/server/reactive/ContextPathCompositeHandlerTests.java

@ -1,5 +1,5 @@ @@ -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");
* you may not use this file except in compliance with the License.
@ -30,8 +30,8 @@ import org.springframework.http.HttpStatus; @@ -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.MockServerHttpResponse;
import static junit.framework.TestCase.assertFalse;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@ -42,7 +42,6 @@ import static org.junit.Assert.fail; @@ -42,7 +42,6 @@ import static org.junit.Assert.fail;
*/
public class ContextPathCompositeHandlerTests {
@Test
public void invalidContextPath() {
testInvalid(" ", "Context path must not be empty");

7
spring-web/src/test/java/org/springframework/http/server/reactive/ListenerWriteProcessorTests.java

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

5
spring-web/src/test/java/org/springframework/http/server/reactive/ServerHttpResponseTests.java

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

2
spring-web/src/test/java/org/springframework/web/bind/support/WebExchangeDataBinderTests.java

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

5
spring-web/src/test/java/org/springframework/web/server/session/InMemoryWebSessionStoreTests.java

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

3
spring-web/src/test/java/org/springframework/web/util/DefaultUriBuilderFactoryTests.java

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

3
spring-webflux/src/test/java/org/springframework/web/reactive/result/view/HttpMessageWriterViewTests.java

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

2
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ReactiveTypeHandlerTests.java

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

3
src/checkstyle/checkstyle-suppressions.xml

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

Loading…
Cancel
Save