Skip to content

Commit 73493bc

Browse files
committed
Revised imports in tests (org.jetbrains.annotations.NotNull etc)
1 parent 370e3d6 commit 73493bc

File tree

84 files changed

+646
-861
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+646
-861
lines changed

spring-web/src/test/java/org/springframework/http/server/reactive/bootstrap/ReactorHttpServer.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* Copyright (c) 2011-2016 Pivotal Software Inc, All Rights Reserved.
2+
* Copyright 2002-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -18,7 +18,6 @@
1818

1919
import java.util.concurrent.atomic.AtomicReference;
2020

21-
import org.jetbrains.annotations.NotNull;
2221
import reactor.core.Loopback;
2322
import reactor.ipc.netty.NettyContext;
2423

@@ -42,11 +41,10 @@ protected void initServer() throws Exception {
4241
this.reactorServer = reactor.ipc.netty.http.server.HttpServer.create(getHost(), getPort());
4342
}
4443

45-
@NotNull
4644
private ReactorHttpHandlerAdapter createHttpHandlerAdapter() {
47-
return getHttpHandlerMap() != null ?
45+
return (getHttpHandlerMap() != null ?
4846
new ReactorHttpHandlerAdapter(getHttpHandlerMap()) :
49-
new ReactorHttpHandlerAdapter(getHttpHandler());
47+
new ReactorHttpHandlerAdapter(getHttpHandler()));
5048
}
5149

5250
@Override

spring-web/src/test/java/org/springframework/http/server/reactive/bootstrap/RxNettyHttpServer.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,14 +16,10 @@
1616

1717
package org.springframework.http.server.reactive.bootstrap;
1818

19-
import java.net.InetSocketAddress;
20-
2119
import io.netty.buffer.ByteBuf;
22-
import org.jetbrains.annotations.NotNull;
2320

2421
import org.springframework.http.server.reactive.RxNettyHttpHandlerAdapter;
2522

26-
2723
/**
2824
* @author Rossen Stoyanchev
2925
*/
@@ -40,11 +36,10 @@ protected void initServer() throws Exception {
4036
this.rxNettyServer = io.reactivex.netty.protocol.http.server.HttpServer.newServer(getPort());
4137
}
4238

43-
@NotNull
4439
private RxNettyHttpHandlerAdapter createHttpHandlerAdapter() {
45-
return getHttpHandlerMap() != null ?
40+
return (getHttpHandlerMap() != null ?
4641
new RxNettyHttpHandlerAdapter(getHttpHandlerMap()) :
47-
new RxNettyHttpHandlerAdapter(getHttpHandler());
42+
new RxNettyHttpHandlerAdapter(getHttpHandler()));
4843
}
4944

5045

spring-web/src/test/java/org/springframework/web/cors/reactive/DefaultCorsProcessorTests.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.web.cors.reactive;
1818

19-
import org.jetbrains.annotations.NotNull;
2019
import org.junit.Before;
2120
import org.junit.Test;
2221

@@ -28,13 +27,8 @@
2827
import org.springframework.web.cors.CorsConfiguration;
2928
import org.springframework.web.server.adapter.DefaultServerWebExchange;
3029

31-
import static org.junit.Assert.assertEquals;
32-
import static org.junit.Assert.assertFalse;
33-
import static org.junit.Assert.assertTrue;
34-
import static org.springframework.http.HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS;
35-
import static org.springframework.http.HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN;
36-
import static org.springframework.http.HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS;
37-
import static org.springframework.http.HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD;
30+
import static org.junit.Assert.*;
31+
import static org.springframework.http.HttpHeaders.*;
3832

3933
/**
4034
* {@link DefaultCorsProcessor} tests with simple or pre-flight CORS request.
@@ -329,6 +323,7 @@ public void preflightRequestWithNullConfig() throws Exception {
329323
assertEquals(HttpStatus.FORBIDDEN, this.response.getStatusCode());
330324
}
331325

326+
332327
private MockServerHttpRequest.BaseBuilder<?> actualRequest() {
333328
return corsRequest(HttpMethod.GET);
334329
}
@@ -343,7 +338,6 @@ private MockServerHttpRequest.BaseBuilder<?> corsRequest(HttpMethod httpMethod)
343338
.header(HttpHeaders.ORIGIN, "http://domain2.com");
344339
}
345340

346-
@NotNull
347341
private DefaultServerWebExchange createExchange() {
348342
return new DefaultServerWebExchange(this.request, this.response);
349343
}

spring-web/src/test/java/org/springframework/web/server/adapter/DefaultServerWebExchangeCheckNotModifiedTests.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,7 +24,6 @@
2424
import java.util.Locale;
2525
import java.util.TimeZone;
2626

27-
import org.jetbrains.annotations.NotNull;
2827
import org.junit.Before;
2928
import org.junit.Test;
3029
import org.junit.runner.RunWith;
@@ -37,10 +36,7 @@
3736
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
3837
import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse;
3938

40-
import static org.junit.Assert.assertEquals;
41-
import static org.junit.Assert.assertFalse;
42-
import static org.junit.Assert.assertNull;
43-
import static org.junit.Assert.assertTrue;
39+
import static org.junit.Assert.*;
4440

4541
/**
4642
* "checkNotModified" unit tests for {@link DefaultServerWebExchange}.
@@ -74,7 +70,7 @@ static public Iterable<Object[]> safeMethods() {
7470

7571

7672
@Before
77-
public void setUp() throws URISyntaxException {
73+
public void setup() throws URISyntaxException {
7874
this.currentDate = Instant.now().truncatedTo(ChronoUnit.SECONDS);
7975
this.dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
8076
this.dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
@@ -319,12 +315,11 @@ public void checkNotModifiedTimestampConditionalPutConflict() throws Exception {
319315
assertEquals(-1, response.getHeaders().getLastModified());
320316
}
321317

322-
@NotNull
318+
323319
private MockServerHttpRequest.BaseBuilder<?> request() {
324320
return MockServerHttpRequest.get("http://example.org");
325321
}
326322

327-
@NotNull
328323
private DefaultServerWebExchange createExchange() {
329324
return new DefaultServerWebExchange(this.request, this.response);
330325
}

spring-web/src/test/java/org/springframework/web/server/adapter/WebHttpHandlerBuilderTests.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.web.server.adapter;
1718

1819
import java.nio.charset.StandardCharsets;
1920

20-
import org.jetbrains.annotations.NotNull;
2121
import org.junit.Test;
2222
import reactor.core.publisher.Flux;
2323
import reactor.core.publisher.Mono;
@@ -36,16 +36,16 @@
3636
import org.springframework.web.server.WebFilter;
3737
import org.springframework.web.server.WebHandler;
3838

39-
import static org.junit.Assert.assertEquals;
39+
import static org.junit.Assert.*;
4040

4141
/**
4242
* Unit tests for {@link WebHttpHandlerBuilder}.
43+
*
4344
* @author Rossen Stoyanchev
4445
*/
4546
public class WebHttpHandlerBuilderTests {
4647

47-
48-
@Test // SPR-15074
48+
@Test // SPR-15074
4949
public void orderedWebFilterBeans() throws Exception {
5050
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
5151
context.register(OrderedWebFilterBeanConfig.class);
@@ -60,7 +60,7 @@ public void orderedWebFilterBeans() throws Exception {
6060
assertEquals("FilterB::FilterA", response.getBodyAsString().blockMillis(5000));
6161
}
6262

63-
@Test // SPR-15074
63+
@Test // SPR-15074
6464
public void orderedWebExceptionHandlerBeans() throws Exception {
6565
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
6666
context.register(OrderedExceptionHandlerBeanConfig.class);
@@ -90,6 +90,7 @@ public void configWithoutFilters() throws Exception {
9090
assertEquals("handled", response.getBodyAsString().blockMillis(5000));
9191
}
9292

93+
9394
private static Mono<Void> writeToResponse(ServerWebExchange exchange, String value) {
9495
byte[] bytes = value.getBytes(StandardCharsets.UTF_8);
9596
DataBuffer buffer = new DefaultDataBufferFactory().wrap(bytes);
@@ -113,7 +114,6 @@ public WebFilter filterB() {
113114
return createFilter("FilterB");
114115
}
115116

116-
@NotNull
117117
private WebFilter createFilter(String name) {
118118
return (exchange, chain) -> {
119119
String value = exchange.getAttribute(ATTRIBUTE).map(v -> v + "::" + name).orElse(name);
@@ -131,6 +131,7 @@ public WebHandler webHandler() {
131131
}
132132
}
133133

134+
134135
@Configuration
135136
@SuppressWarnings("unused")
136137
static class OrderedExceptionHandlerBeanConfig {
@@ -153,6 +154,7 @@ public WebHandler webHandler() {
153154
}
154155
}
155156

157+
156158
@Configuration
157159
@SuppressWarnings("unused")
158160
static class NoFilterConfig {

spring-web/src/test/java/org/springframework/web/server/handler/ResponseStatusExceptionHandlerTests.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@
1818

1919
import java.time.Duration;
2020

21-
import org.jetbrains.annotations.NotNull;
2221
import org.junit.Before;
2322
import org.junit.Test;
2423
import reactor.core.publisher.Mono;
@@ -30,8 +29,7 @@
3029
import org.springframework.web.server.ResponseStatusException;
3130
import org.springframework.web.server.adapter.DefaultServerWebExchange;
3231

33-
import static org.junit.Assert.assertEquals;
34-
import static org.junit.Assert.assertSame;
32+
import static org.junit.Assert.*;
3533

3634
/**
3735
* Unit tests for {@link ResponseStatusExceptionHandler}.
@@ -48,7 +46,7 @@ public class ResponseStatusExceptionHandlerTests {
4846

4947

5048
@Before
51-
public void setUp() throws Exception {
49+
public void setup() throws Exception {
5250
this.handler = new ResponseStatusExceptionHandler();
5351
this.request = MockServerHttpRequest.get("/").build();
5452
this.response = new MockServerHttpResponse();
@@ -69,7 +67,7 @@ public void unresolvedException() throws Exception {
6967
StepVerifier.create(mono).consumeErrorWith(actual -> assertSame(expected, actual)).verify();
7068
}
7169

72-
@NotNull
70+
7371
private DefaultServerWebExchange createExchange() {
7472
return new DefaultServerWebExchange(this.request, this.response);
7573
}

0 commit comments

Comments
 (0)