From 73dbd06361c5b902857d3dae68b770523318288d Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sun, 12 May 2019 15:13:07 +0200 Subject: [PATCH] Enforces static imports for JUnit 4 assertions and assumptions This commit configures Checkstyle to enforces static imports for JUnit 4 assertions and assumptions. See gh-22932 --- .../aspectj/AspectJCacheAnnotationTests.java | 3 +-- .../config/CacheAdviceNamespaceTests.java | 7 +++--- .../jdbc/core/simple/SimpleJdbcCallTests.java | 3 +-- .../oxm/jibx/JibxMarshallerTests.java | 4 ++-- .../oxm/jibx/JibxUnmarshallerTests.java | 4 ++-- .../standalone/MultipartControllerTests.java | 10 ++++---- .../AsyncRestTemplateIntegrationTests.java | 3 +-- .../function/BodyExtractorsTests.java | 4 ++-- .../reactive/function/BodyInsertersTests.java | 6 ++--- .../annotation/ProtobufIntegrationTests.java | 24 ++++++++++--------- .../annotation/SseIntegrationTests.java | 3 +-- .../ScriptTemplateViewResolverTests.java | 9 +++---- .../RequestPartIntegrationTests.java | 4 ++-- .../groovy/GroovyMarkupViewResolverTests.java | 14 ++++++----- .../ScriptTemplateViewResolverTests.java | 9 +++---- src/checkstyle/checkstyle.xml | 2 +- 16 files changed, 56 insertions(+), 53 deletions(-) diff --git a/spring-aspects/src/test/java/org/springframework/cache/aspectj/AspectJCacheAnnotationTests.java b/spring-aspects/src/test/java/org/springframework/cache/aspectj/AspectJCacheAnnotationTests.java index 8346f4d22d7..ac9d41e8181 100644 --- a/spring-aspects/src/test/java/org/springframework/cache/aspectj/AspectJCacheAnnotationTests.java +++ b/spring-aspects/src/test/java/org/springframework/cache/aspectj/AspectJCacheAnnotationTests.java @@ -16,7 +16,6 @@ package org.springframework.cache.aspectj; -import org.junit.Assert; import org.junit.Test; import org.springframework.cache.Cache; @@ -44,7 +43,7 @@ public class AspectJCacheAnnotationTests extends AbstractCacheAnnotationTests { public void testKeyStrategy() throws Exception { AnnotationCacheAspect aspect = ctx.getBean( "org.springframework.cache.config.internalCacheAspect", AnnotationCacheAspect.class); - Assert.assertSame(ctx.getBean("keyGenerator"), aspect.getKeyGenerator()); + assertSame(ctx.getBean("keyGenerator"), aspect.getKeyGenerator()); } @Override diff --git a/spring-context/src/test/java/org/springframework/cache/config/CacheAdviceNamespaceTests.java b/spring-context/src/test/java/org/springframework/cache/config/CacheAdviceNamespaceTests.java index e6484d0e7f9..e1d88a8c080 100644 --- a/spring-context/src/test/java/org/springframework/cache/config/CacheAdviceNamespaceTests.java +++ b/spring-context/src/test/java/org/springframework/cache/config/CacheAdviceNamespaceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 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. @@ -16,13 +16,14 @@ package org.springframework.cache.config; -import org.junit.Assert; import org.junit.Test; import org.springframework.cache.interceptor.CacheInterceptor; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.GenericXmlApplicationContext; +import static org.junit.Assert.assertSame; + /** * @author Costin Leau * @author Chris Beams @@ -38,7 +39,7 @@ public class CacheAdviceNamespaceTests extends AbstractCacheAnnotationTests { @Test public void testKeyStrategy() throws Exception { CacheInterceptor bean = this.ctx.getBean("cacheAdviceClass", CacheInterceptor.class); - Assert.assertSame(this.ctx.getBean("keyGenerator"), bean.getKeyGenerator()); + assertSame(this.ctx.getBean("keyGenerator"), bean.getKeyGenerator()); } } diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcCallTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcCallTests.java index 9ace33d48fa..91aa00ca84b 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcCallTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcCallTests.java @@ -24,7 +24,6 @@ import java.sql.SQLException; import java.sql.Types; import javax.sql.DataSource; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -232,7 +231,7 @@ public class SimpleJdbcCallTests { private void verifyStatement(SimpleJdbcCall adder, String expected) { - Assert.assertEquals("Incorrect call statement", expected, adder.getCallString()); + assertEquals("Incorrect call statement", expected, adder.getCallString()); } private void initializeAddInvoiceWithoutMetaData(boolean isFunction) throws SQLException { diff --git a/spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxMarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxMarshallerTests.java index 807d35f8bad..9b02f4ef9fd 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxMarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxMarshallerTests.java @@ -19,7 +19,6 @@ package org.springframework.oxm.jibx; import java.io.StringWriter; import javax.xml.transform.stream.StreamResult; -import org.junit.Assume; import org.junit.BeforeClass; import org.junit.Test; @@ -28,6 +27,7 @@ import org.springframework.oxm.AbstractMarshallerTests; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeTrue; import static org.xmlunit.matchers.CompareMatcher.isSimilarTo; /** @@ -43,7 +43,7 @@ public class JibxMarshallerTests extends AbstractMarshallerTests @BeforeClass public static void compilerAssumptions() { // JiBX compiler is currently not compatible with JDK 9 - Assume.assumeTrue(System.getProperty("java.version").startsWith("1.8.")); + assumeTrue(System.getProperty("java.version").startsWith("1.8.")); } diff --git a/spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxUnmarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxUnmarshallerTests.java index 8909d46cc71..a914829ef08 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxUnmarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxUnmarshallerTests.java @@ -19,7 +19,6 @@ package org.springframework.oxm.jibx; import java.io.ByteArrayInputStream; import javax.xml.transform.stream.StreamSource; -import org.junit.Assume; import org.junit.BeforeClass; import org.junit.Test; @@ -27,6 +26,7 @@ import org.springframework.oxm.AbstractUnmarshallerTests; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assume.assumeTrue; /** * NOTE: These tests fail under Eclipse/IDEA because JiBX binding does @@ -46,7 +46,7 @@ public class JibxUnmarshallerTests extends AbstractUnmarshallerTests 0) { byte[] content = file[0].getBytes(); - Assert.assertArrayEquals(content, file[1].getBytes()); + assertArrayEquals(content, file[1].getBytes()); model.addAttribute("fileContent", content); } if (json != null) { @@ -291,7 +291,7 @@ public class MultipartControllerTests { if (file != null && !file.isEmpty()) { byte[] content = file.get(0).getBytes(); - Assert.assertArrayEquals(content, file.get(1).getBytes()); + assertArrayEquals(content, file.get(1).getBytes()); model.addAttribute("fileContent", content); } if (json != null) { @@ -319,7 +319,7 @@ public class MultipartControllerTests { if (file.isPresent()) { byte[] content = file.get()[0].getBytes(); - Assert.assertArrayEquals(content, file.get()[1].getBytes()); + assertArrayEquals(content, file.get()[1].getBytes()); model.addAttribute("fileContent", content); } model.addAttribute("jsonContent", json); @@ -333,7 +333,7 @@ public class MultipartControllerTests { if (file.isPresent()) { byte[] content = file.get().get(0).getBytes(); - Assert.assertArrayEquals(content, file.get().get(1).getBytes()); + assertArrayEquals(content, file.get().get(1).getBytes()); model.addAttribute("fileContent", content); } model.addAttribute("jsonContent", json); diff --git a/spring-web/src/test/java/org/springframework/web/client/AsyncRestTemplateIntegrationTests.java b/spring-web/src/test/java/org/springframework/web/client/AsyncRestTemplateIntegrationTests.java index e898d939779..993b2ec32cb 100644 --- a/spring-web/src/test/java/org/springframework/web/client/AsyncRestTemplateIntegrationTests.java +++ b/spring-web/src/test/java/org/springframework/web/client/AsyncRestTemplateIntegrationTests.java @@ -27,7 +27,6 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import org.junit.Assert; import org.junit.Test; import org.springframework.core.io.ClassPathResource; @@ -315,7 +314,7 @@ public class AsyncRestTemplateIntegrationTests extends AbstractMockWebServerTest @Test public void deleteCallbackWithLambdas() throws Exception { ListenableFuture deletedFuture = template.delete(new URI(baseUrl + "/delete")); - deletedFuture.addCallback(Assert::assertNull, ex -> fail(ex.getMessage())); + deletedFuture.addCallback(result -> assertNull(result), ex -> fail(ex.getMessage())); waitTillDone(deletedFuture); } diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyExtractorsTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyExtractorsTests.java index 0b8cf3fa339..6bfafc39a7a 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyExtractorsTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyExtractorsTests.java @@ -29,7 +29,6 @@ import java.util.Optional; import com.fasterxml.jackson.annotation.JsonView; import io.netty.buffer.PooledByteBufAllocator; import io.netty.util.IllegalReferenceCountException; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import reactor.core.publisher.Flux; @@ -67,6 +66,7 @@ import org.springframework.util.MultiValueMap; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import static org.springframework.http.codec.json.Jackson2CodecSupport.JSON_VIEW_HINT; /** @@ -436,7 +436,7 @@ public class BodyExtractorsTests { assertTrue(throwable instanceof UnsupportedMediaTypeException); try { buffer.release(); - Assert.fail("releasing the buffer should have failed"); + fail("releasing the buffer should have failed"); } catch (IllegalReferenceCountException exc) { } diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyInsertersTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyInsertersTests.java index e9410a8d632..7321228de53 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyInsertersTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyInsertersTests.java @@ -30,7 +30,6 @@ import java.util.Map; import java.util.Optional; import com.fasterxml.jackson.annotation.JsonView; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import reactor.core.publisher.Flux; @@ -71,6 +70,7 @@ import static java.nio.charset.StandardCharsets.UTF_8; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; import static org.springframework.http.codec.json.Jackson2CodecSupport.JSON_VIEW_HINT; /** @@ -127,7 +127,7 @@ public class BodyInsertersTests { StepVerifier.create(response.getBody()) .consumeNextWith(buf -> { String actual = DataBufferTestUtils.dumpString(buf, UTF_8); - Assert.assertEquals("foo", actual); + assertEquals("foo", actual); }) .expectComplete() .verify(); @@ -173,7 +173,7 @@ public class BodyInsertersTests { StepVerifier.create(response.getBody()) .consumeNextWith(buf -> { String actual = DataBufferTestUtils.dumpString(buf, UTF_8); - Assert.assertEquals("foo", actual); + assertEquals("foo", actual); }) .expectComplete() .verify(); diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ProtobufIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ProtobufIntegrationTests.java index 9711e78fb34..0721ca66e2d 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ProtobufIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ProtobufIntegrationTests.java @@ -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. @@ -18,7 +18,6 @@ package org.springframework.web.reactive.result.method.annotation; import java.time.Duration; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import reactor.core.publisher.Flux; @@ -36,6 +35,9 @@ import org.springframework.web.reactive.function.client.WebClient; import org.springframework.web.reactive.protobuf.Msg; import org.springframework.web.reactive.protobuf.SecondMsg; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + /** * Integration tests for Protobuf support. * @@ -71,9 +73,9 @@ public class ProtobufIntegrationTests extends AbstractRequestMappingIntegrationT .uri("/message") .exchange() .doOnNext(response -> { - Assert.assertFalse(response.headers().contentType().get().getParameters().containsKey("delimited")); - Assert.assertEquals("sample.proto", response.headers().header("X-Protobuf-Schema").get(0)); - Assert.assertEquals("Msg", response.headers().header("X-Protobuf-Message").get(0)); + assertFalse(response.headers().contentType().get().getParameters().containsKey("delimited")); + assertEquals("sample.proto", response.headers().header("X-Protobuf-Schema").get(0)); + assertEquals("Msg", response.headers().header("X-Protobuf-Message").get(0)); }) .flatMap(response -> response.bodyToMono(Msg.class)); @@ -88,9 +90,9 @@ public class ProtobufIntegrationTests extends AbstractRequestMappingIntegrationT .uri("/messages") .exchange() .doOnNext(response -> { - Assert.assertEquals("true", response.headers().contentType().get().getParameters().get("delimited")); - Assert.assertEquals("sample.proto", response.headers().header("X-Protobuf-Schema").get(0)); - Assert.assertEquals("Msg", response.headers().header("X-Protobuf-Message").get(0)); + assertEquals("true", response.headers().contentType().get().getParameters().get("delimited")); + assertEquals("sample.proto", response.headers().header("X-Protobuf-Schema").get(0)); + assertEquals("Msg", response.headers().header("X-Protobuf-Message").get(0)); }) .flatMapMany(response -> response.bodyToFlux(Msg.class)); @@ -107,9 +109,9 @@ public class ProtobufIntegrationTests extends AbstractRequestMappingIntegrationT .uri("/message-stream") .exchange() .doOnNext(response -> { - Assert.assertEquals("true", response.headers().contentType().get().getParameters().get("delimited")); - Assert.assertEquals("sample.proto", response.headers().header("X-Protobuf-Schema").get(0)); - Assert.assertEquals("Msg", response.headers().header("X-Protobuf-Message").get(0)); + assertEquals("true", response.headers().contentType().get().getParameters().get("delimited")); + assertEquals("sample.proto", response.headers().header("X-Protobuf-Schema").get(0)); + assertEquals("Msg", response.headers().header("X-Protobuf-Message").get(0)); }) .flatMapMany(response -> response.bodyToFlux(Msg.class)); diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java index 9a2d428be5d..264aa86fc53 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java @@ -19,7 +19,6 @@ package org.springframework.web.reactive.result.method.annotation; import java.io.File; import java.time.Duration; -import org.junit.Assume; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; @@ -136,7 +135,7 @@ public class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests { @Test public void sseAsEvent() { - Assume.assumeTrue(server instanceof JettyHttpServer); + assumeTrue(server instanceof JettyHttpServer); Flux> result = this.webClient.get() .uri("/event") diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/script/ScriptTemplateViewResolverTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/script/ScriptTemplateViewResolverTests.java index a65d512c9be..e77bbedfdd5 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/script/ScriptTemplateViewResolverTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/script/ScriptTemplateViewResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 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. @@ -16,11 +16,12 @@ package org.springframework.web.reactive.result.view.script; -import org.junit.Assert; import org.junit.Test; import org.springframework.beans.DirectFieldAccessor; +import static org.junit.Assert.assertEquals; + /** * Unit tests for {@link ScriptTemplateViewResolver}. * @@ -31,10 +32,10 @@ public class ScriptTemplateViewResolverTests { @Test public void viewClass() throws Exception { ScriptTemplateViewResolver resolver = new ScriptTemplateViewResolver(); - Assert.assertEquals(ScriptTemplateView.class, resolver.requiredViewClass()); + assertEquals(ScriptTemplateView.class, resolver.requiredViewClass()); DirectFieldAccessor viewAccessor = new DirectFieldAccessor(resolver); Class viewClass = (Class) viewAccessor.getPropertyValue("viewClass"); - Assert.assertEquals(ScriptTemplateView.class, viewClass); + assertEquals(ScriptTemplateView.class, viewClass); } } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartIntegrationTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartIntegrationTests.java index e9184feb287..e38df85ff5a 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartIntegrationTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartIntegrationTests.java @@ -31,7 +31,6 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.junit.AfterClass; -import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -67,6 +66,7 @@ import org.springframework.web.servlet.DispatcherServlet; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.springframework.web.bind.annotation.RequestMethod.POST; @@ -239,7 +239,7 @@ public class RequestPartIntegrationTests { @RequestPart(name = "empty-data", required = false) TestData emptyData, @RequestPart(name = "iso-8859-1-data") byte[] iso88591Data) { - Assert.assertArrayEquals(new byte[]{(byte) 0xC4}, iso88591Data); + assertArrayEquals(new byte[]{(byte) 0xC4}, iso88591Data); String url = "http://localhost:8080/test/" + testData.getName() + "/" + file.get().getOriginalFilename(); HttpHeaders headers = new HttpHeaders(); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/groovy/GroovyMarkupViewResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/groovy/GroovyMarkupViewResolverTests.java index 74efc21b10b..7fa34f90e92 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/groovy/GroovyMarkupViewResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/groovy/GroovyMarkupViewResolverTests.java @@ -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. @@ -18,11 +18,13 @@ package org.springframework.web.servlet.view.groovy; import java.util.Locale; -import org.junit.Assert; import org.junit.Test; import org.springframework.beans.DirectFieldAccessor; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + /** * Unit tests for * {@link org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver}. @@ -34,18 +36,18 @@ public class GroovyMarkupViewResolverTests { @Test public void viewClass() throws Exception { GroovyMarkupViewResolver resolver = new GroovyMarkupViewResolver(); - Assert.assertEquals(GroovyMarkupView.class, resolver.requiredViewClass()); + assertEquals(GroovyMarkupView.class, resolver.requiredViewClass()); DirectFieldAccessor viewAccessor = new DirectFieldAccessor(resolver); Class viewClass = (Class) viewAccessor.getPropertyValue("viewClass"); - Assert.assertEquals(GroovyMarkupView.class, viewClass); + assertEquals(GroovyMarkupView.class, viewClass); } @Test public void cacheKey() throws Exception { GroovyMarkupViewResolver resolver = new GroovyMarkupViewResolver(); String cacheKey = (String) resolver.getCacheKey("test", Locale.US); - Assert.assertNotNull(cacheKey); - Assert.assertEquals("test_en_US", cacheKey); + assertNotNull(cacheKey); + assertEquals("test_en_US", cacheKey); } } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/script/ScriptTemplateViewResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/script/ScriptTemplateViewResolverTests.java index 62542f93f94..bf50b2eced5 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/script/ScriptTemplateViewResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/script/ScriptTemplateViewResolverTests.java @@ -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. @@ -16,11 +16,12 @@ package org.springframework.web.servlet.view.script; -import org.junit.Assert; import org.junit.Test; import org.springframework.beans.DirectFieldAccessor; +import static org.junit.Assert.assertEquals; + /** * Unit tests for {@link ScriptTemplateViewResolver}. * @@ -31,10 +32,10 @@ public class ScriptTemplateViewResolverTests { @Test public void viewClass() throws Exception { ScriptTemplateViewResolver resolver = new ScriptTemplateViewResolver(); - Assert.assertEquals(ScriptTemplateView.class, resolver.requiredViewClass()); + assertEquals(ScriptTemplateView.class, resolver.requiredViewClass()); DirectFieldAccessor viewAccessor = new DirectFieldAccessor(resolver); Class viewClass = (Class) viewAccessor.getPropertyValue("viewClass"); - Assert.assertEquals(ScriptTemplateView.class, viewClass); + assertEquals(ScriptTemplateView.class, viewClass); } } diff --git a/src/checkstyle/checkstyle.xml b/src/checkstyle/checkstyle.xml index c3109026b5f..e369f86a222 100644 --- a/src/checkstyle/checkstyle.xml +++ b/src/checkstyle/checkstyle.xml @@ -97,7 +97,7 @@ + value="^reactor\.core\.support\.Assert,^junit\.framework\..+,^org\.junit\.Assert$,^org\.junit\.Assume$,^org\.junit\.Assert\.assertThat,^org\.junit\.Assume\.assumeThat,^org\.junit\.rules\.ExpectedException,^org\.slf4j\.LoggerFactory" />