Polish
This commit is contained in:
@@ -108,7 +108,7 @@ class MappingJackson2HttpMessageConverterTests {
|
||||
}
|
||||
|
||||
@Test // SPR-7905
|
||||
public void canReadAndWriteMicroformats() {
|
||||
void canReadAndWriteMicroformats() {
|
||||
assertThat(converter.canRead(MyBean.class, new MediaType("application", "vnd.test-micro-type+json"))).isTrue();
|
||||
assertThat(converter.canWrite(MyBean.class, new MediaType("application", "vnd.test-micro-type+json"))).isTrue();
|
||||
}
|
||||
@@ -151,7 +151,7 @@ class MappingJackson2HttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readUntyped() throws IOException {
|
||||
void readUntyped() throws IOException {
|
||||
String body = "{" +
|
||||
"\"bytes\":\"AQI=\"," +
|
||||
"\"array\":[\"Foo\",\"Bar\"]," +
|
||||
@@ -247,7 +247,7 @@ class MappingJackson2HttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readAndWriteGenerics() throws Exception {
|
||||
void readAndWriteGenerics() throws Exception {
|
||||
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter() {
|
||||
@Override
|
||||
protected JavaType getJavaType(Type type, @Nullable Class<?> contextClass) {
|
||||
@@ -286,7 +286,7 @@ class MappingJackson2HttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readAndWriteParameterizedType() throws Exception {
|
||||
void readAndWriteParameterizedType() throws Exception {
|
||||
ParameterizedTypeReference<List<MyBean>> beansList = new ParameterizedTypeReference<>() {};
|
||||
|
||||
String body = "[{" +
|
||||
@@ -317,7 +317,7 @@ class MappingJackson2HttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void writeParameterizedBaseType() throws Exception {
|
||||
void writeParameterizedBaseType() throws Exception {
|
||||
ParameterizedTypeReference<List<MyBean>> beansList = new ParameterizedTypeReference<>() {};
|
||||
ParameterizedTypeReference<List<MyBase>> baseList = new ParameterizedTypeReference<>() {};
|
||||
|
||||
@@ -460,7 +460,7 @@ class MappingJackson2HttpMessageConverterTests {
|
||||
}
|
||||
|
||||
@Test // SPR-13318
|
||||
public void writeSubType() throws Exception {
|
||||
void writeSubType() throws Exception {
|
||||
MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
|
||||
MyBean bean = new MyBean();
|
||||
bean.setString("Foo");
|
||||
@@ -474,7 +474,7 @@ class MappingJackson2HttpMessageConverterTests {
|
||||
}
|
||||
|
||||
@Test // SPR-13318
|
||||
public void writeSubTypeList() throws Exception {
|
||||
void writeSubTypeList() throws Exception {
|
||||
MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
|
||||
List<MyBean> beans = new ArrayList<>();
|
||||
MyBean foo = new MyBean();
|
||||
@@ -498,7 +498,7 @@ class MappingJackson2HttpMessageConverterTests {
|
||||
}
|
||||
|
||||
@Test // gh-27511
|
||||
public void readWithNoDefaultConstructor() throws Exception {
|
||||
void readWithNoDefaultConstructor() throws Exception {
|
||||
String body = "{\"property1\":\"foo\",\"property2\":\"bar\"}";
|
||||
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body.getBytes(StandardCharsets.UTF_8));
|
||||
inputMessage.getHeaders().setContentType(MediaType.APPLICATION_JSON);
|
||||
@@ -510,7 +510,7 @@ class MappingJackson2HttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readNonUnicode() throws Exception {
|
||||
void readNonUnicode() throws Exception {
|
||||
String body = "{\"føø\":\"bår\"}";
|
||||
Charset charset = StandardCharsets.ISO_8859_1;
|
||||
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body.getBytes(charset));
|
||||
@@ -522,7 +522,7 @@ class MappingJackson2HttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readAscii() throws Exception {
|
||||
void readAscii() throws Exception {
|
||||
String body = "{\"foo\":\"bar\"}";
|
||||
Charset charset = StandardCharsets.US_ASCII;
|
||||
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body.getBytes(charset));
|
||||
@@ -533,7 +533,7 @@ class MappingJackson2HttpMessageConverterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void writeAscii() throws Exception {
|
||||
void writeAscii() throws Exception {
|
||||
MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
|
||||
Map<String,Object> body = new HashMap<>();
|
||||
body.put("foo", "bar");
|
||||
|
||||
@@ -193,7 +193,7 @@ class MappingJackson2XmlHttpMessageConverterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void readNonUnicode() throws Exception {
|
||||
void readNonUnicode() throws Exception {
|
||||
String body = "<MyBean>" +
|
||||
"<string>føø bår</string>" +
|
||||
"</MyBean>";
|
||||
|
||||
@@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
class RequestAndSessionScopedBeanTests {
|
||||
|
||||
@Test
|
||||
public void testPutBeanInRequest() {
|
||||
void testPutBeanInRequest() {
|
||||
String targetBeanName = "target";
|
||||
|
||||
StaticWebApplicationContext wac = new StaticWebApplicationContext();
|
||||
@@ -70,7 +70,7 @@ class RequestAndSessionScopedBeanTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPutBeanInSession() {
|
||||
void testPutBeanInSession() {
|
||||
String targetBeanName = "target";
|
||||
HttpServletRequest request = new MockHttpServletRequest();
|
||||
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
|
||||
|
||||
@@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
class AnnotationConfigWebApplicationContextTests {
|
||||
|
||||
@Test
|
||||
public void registerSingleClass() {
|
||||
void registerSingleClass() {
|
||||
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
|
||||
ctx.register(Config.class);
|
||||
ctx.refresh();
|
||||
@@ -43,7 +43,7 @@ class AnnotationConfigWebApplicationContextTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void configLocationWithSingleClass() {
|
||||
void configLocationWithSingleClass() {
|
||||
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
|
||||
ctx.setConfigLocation(Config.class.getName());
|
||||
ctx.refresh();
|
||||
@@ -53,7 +53,7 @@ class AnnotationConfigWebApplicationContextTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void configLocationWithBasePackage() {
|
||||
void configLocationWithBasePackage() {
|
||||
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
|
||||
ctx.setConfigLocation("org.springframework.web.context.support");
|
||||
ctx.refresh();
|
||||
@@ -63,7 +63,7 @@ class AnnotationConfigWebApplicationContextTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withBeanNameGenerator() {
|
||||
void withBeanNameGenerator() {
|
||||
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
|
||||
ctx.setBeanNameGenerator(new AnnotationBeanNameGenerator() {
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
@@ -51,7 +51,7 @@ public abstract class AbstractResponseStatusExceptionHandlerTests {
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
protected void setup() {
|
||||
this.handler = createResponseStatusExceptionHandler();
|
||||
}
|
||||
|
||||
@@ -61,21 +61,21 @@ public abstract class AbstractResponseStatusExceptionHandlerTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void handleResponseStatusException() {
|
||||
protected void handleResponseStatusException() {
|
||||
Throwable ex = new ResponseStatusException(HttpStatus.BAD_REQUEST, "");
|
||||
this.handler.handle(this.exchange, ex).block(Duration.ofSeconds(5));
|
||||
assertThat(this.exchange.getResponse().getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handleNestedResponseStatusException() {
|
||||
protected void handleNestedResponseStatusException() {
|
||||
Throwable ex = new Exception(new ResponseStatusException(HttpStatus.BAD_REQUEST, ""));
|
||||
this.handler.handle(this.exchange, ex).block(Duration.ofSeconds(5));
|
||||
assertThat(this.exchange.getResponse().getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@Test // gh-23741
|
||||
public void handleMethodNotAllowed() {
|
||||
protected void handleMethodNotAllowed() {
|
||||
Throwable ex = new MethodNotAllowedException(HttpMethod.PATCH, Arrays.asList(HttpMethod.POST, HttpMethod.PUT));
|
||||
this.handler.handle(this.exchange, ex).block(Duration.ofSeconds(5));
|
||||
|
||||
@@ -85,7 +85,7 @@ public abstract class AbstractResponseStatusExceptionHandlerTests {
|
||||
}
|
||||
|
||||
@Test // gh-23741
|
||||
public void handleResponseStatusExceptionWithHeaders() {
|
||||
protected void handleResponseStatusExceptionWithHeaders() {
|
||||
Throwable ex = new NotAcceptableStatusException(Arrays.asList(MediaType.TEXT_PLAIN, MediaType.TEXT_HTML));
|
||||
this.handler.handle(this.exchange, ex).block(Duration.ofSeconds(5));
|
||||
|
||||
@@ -95,14 +95,14 @@ public abstract class AbstractResponseStatusExceptionHandlerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unresolvedException() {
|
||||
protected void unresolvedException() {
|
||||
Throwable expected = new IllegalStateException();
|
||||
Mono<Void> mono = this.handler.handle(this.exchange, expected);
|
||||
StepVerifier.create(mono).consumeErrorWith(actual -> assertThat(actual).isSameAs(expected)).verify();
|
||||
}
|
||||
|
||||
@Test // SPR-16231
|
||||
public void responseCommitted() {
|
||||
protected void responseCommitted() {
|
||||
Throwable ex = new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, "Oops");
|
||||
this.exchange.getResponse().setStatusCode(HttpStatus.CREATED);
|
||||
Mono<Void> mono = this.exchange.getResponse().setComplete()
|
||||
|
||||
Reference in New Issue
Block a user