Fix new Sonar smells

This commit is contained in:
Artem Bilan
2020-02-24 11:57:02 -05:00
parent 50ac603d6c
commit 7dbdbdee3f
7 changed files with 86 additions and 95 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2019 the original author or authors.
* Copyright 2015-2020 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,17 +18,15 @@ package org.springframework.integration.http.inbound;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerExecutionChain;
@@ -39,8 +37,7 @@ import org.springframework.web.servlet.HandlerInterceptor;
*
* @since 4.2
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@SpringJUnitConfig
@DirtiesContext
public class CrossOriginTests {
@@ -49,7 +46,7 @@ public class CrossOriginTests {
private MockHttpServletRequest request;
@Before
@BeforeEach
public void setUp() {
this.request = new MockHttpServletRequest();
this.request.setMethod("GET");
@@ -91,7 +88,7 @@ public class CrossOriginTests {
assertThat(config.getAllowedOrigins().toArray()).isEqualTo(new String[] { "*" });
assertThat(config.getAllowCredentials()).isTrue();
assertThat(config.getAllowedHeaders().toArray()).isEqualTo(new String[] { "*" });
assertThat(config.getExposedHeaders()).isNull();
assertThat(config.getExposedHeaders()).isEmpty();
assertThat(config.getMaxAge()).isEqualTo(new Long(1800));
}
@@ -122,7 +119,7 @@ public class CrossOriginTests {
assertThat(config.getAllowedOrigins().toArray()).isEqualTo(new String[] { "*" });
assertThat(config.getAllowCredentials()).isTrue();
assertThat(config.getAllowedHeaders().toArray()).isEqualTo(new String[] { "*" });
assertThat(config.getExposedHeaders()).isNull();
assertThat(config.getExposedHeaders()).isEmpty();
assertThat(config.getMaxAge()).isEqualTo(new Long(1800));
}