Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -20,7 +20,6 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
@@ -36,6 +35,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.reactive.config.EnableWebFlux;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Sebastien Deleuze
|
||||
*/
|
||||
@@ -49,6 +50,7 @@ public class JacksonHintsIntegrationTests extends AbstractRequestMappingIntegrat
|
||||
return wac;
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void jsonViewResponse() throws Exception {
|
||||
String expected = "{\"withView1\":\"with\"}";
|
||||
@@ -98,6 +100,7 @@ public class JacksonHintsIntegrationTests extends AbstractRequestMappingIntegrat
|
||||
static class WebConfig {
|
||||
}
|
||||
|
||||
|
||||
@RestController
|
||||
@SuppressWarnings("unused")
|
||||
private static class JsonViewRestController {
|
||||
@@ -188,4 +191,4 @@ public class JacksonHintsIntegrationTests extends AbstractRequestMappingIntegrat
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -42,8 +42,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.reactive.config.EnableWebFlux;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Data binding and type conversion related integration tests for
|
||||
@@ -89,6 +88,7 @@ public class RequestMappingDataBindingIntegrationTests extends AbstractRequestMa
|
||||
static class WebConfig {
|
||||
}
|
||||
|
||||
|
||||
@RestController
|
||||
@SuppressWarnings({"unused", "OptionalUsedAsFieldOrParameterType"})
|
||||
private static class TestController {
|
||||
@@ -120,6 +120,7 @@ public class RequestMappingDataBindingIntegrationTests extends AbstractRequestMa
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class Foo {
|
||||
|
||||
private final Long id;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -31,8 +31,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.reactive.config.EnableWebFlux;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* {@code @RequestMapping} integration tests with exception handling scenarios.
|
||||
@@ -41,7 +40,6 @@ import static org.junit.Assert.assertEquals;
|
||||
*/
|
||||
public class RequestMappingExceptionHandlingIntegrationTests extends AbstractRequestMappingIntegrationTests {
|
||||
|
||||
|
||||
@Override
|
||||
protected ApplicationContext initApplicationContext() {
|
||||
AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext();
|
||||
@@ -69,7 +67,6 @@ public class RequestMappingExceptionHandlingIntegrationTests extends AbstractReq
|
||||
@ComponentScan(resourcePattern = "**/RequestMappingExceptionHandlingIntegrationTests$*.class")
|
||||
@SuppressWarnings({"unused", "WeakerAccess"})
|
||||
static class WebConfig {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +93,6 @@ public class RequestMappingExceptionHandlingIntegrationTests extends AbstractReq
|
||||
public ResponseEntity<Publisher<String>> handleStateException(IllegalStateException ex) {
|
||||
return ResponseEntity.ok(Mono.just("Recovered from error: " + ex.getMessage()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -31,9 +31,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.reactive.config.EnableWebFlux;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Integration tests with {@code @RequestMapping} handler methods.
|
||||
@@ -54,6 +52,7 @@ public class RequestMappingIntegrationTests extends AbstractRequestMappingIntegr
|
||||
return wac;
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void handleWithParam() throws Exception {
|
||||
String expected = "Hello George!";
|
||||
@@ -86,6 +85,7 @@ public class RequestMappingIntegrationTests extends AbstractRequestMappingIntegr
|
||||
static class WebConfig {
|
||||
}
|
||||
|
||||
|
||||
@RestController
|
||||
@SuppressWarnings("unused")
|
||||
private static class TestRestController {
|
||||
@@ -104,9 +104,9 @@ public class RequestMappingIntegrationTests extends AbstractRequestMappingIntegr
|
||||
public Publisher<Foo> objectStreamResponseBody() {
|
||||
return Flux.just(new Foo("bar"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static class Foo {
|
||||
|
||||
private String name;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -39,10 +39,7 @@ import org.springframework.web.reactive.config.WebFluxConfigurationSupport;
|
||||
import org.springframework.web.reactive.result.view.freemarker.FreeMarkerConfigurer;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.springframework.http.RequestEntity.get;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* {@code @RequestMapping} integration tests with view resolution scenarios.
|
||||
@@ -51,7 +48,6 @@ import static org.springframework.http.RequestEntity.get;
|
||||
*/
|
||||
public class RequestMappingViewResolutionIntegrationTests extends AbstractRequestMappingIntegrationTests {
|
||||
|
||||
|
||||
@Override
|
||||
protected ApplicationContext initApplicationContext() {
|
||||
AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext();
|
||||
@@ -70,7 +66,7 @@ public class RequestMappingViewResolutionIntegrationTests extends AbstractReques
|
||||
@Test
|
||||
public void etagCheckWithNotModifiedResponse() throws Exception {
|
||||
URI uri = new URI("http://localhost:" + this.port + "/html");
|
||||
RequestEntity<Void> request = get(uri).ifNoneMatch("\"deadb33f8badf00d\"").build();
|
||||
RequestEntity<Void> request = RequestEntity.get(uri).ifNoneMatch("\"deadb33f8badf00d\"").build();
|
||||
ResponseEntity<String> response = getRestTemplate().exchange(request, String.class);
|
||||
|
||||
assertEquals(HttpStatus.NOT_MODIFIED, response.getStatusCode());
|
||||
@@ -95,9 +91,9 @@ public class RequestMappingViewResolutionIntegrationTests extends AbstractReques
|
||||
configurer.setTemplateLoaderPath("classpath*:org/springframework/web/reactive/view/freemarker/");
|
||||
return configurer;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Controller
|
||||
@SuppressWarnings("unused")
|
||||
private static class TestController {
|
||||
@@ -112,7 +108,6 @@ public class RequestMappingViewResolutionIntegrationTests extends AbstractReques
|
||||
model.addAttribute("hello", "Hello: " + name.orElse("<no name>") + "!");
|
||||
return "test";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user