Skip to content

Commit 31316a1

Browse files
committed
Polishing
1 parent b2a0978 commit 31316a1

File tree

8 files changed

+23
-25
lines changed

8 files changed

+23
-25
lines changed

spring-test/src/test/java/org/springframework/mock/web/MockHttpServletRequestTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,7 @@ void cookies() {
297297

298298
assertThat(cookieHeaders)
299299
.describedAs("Cookies -> Header conversion works as expected per RFC6265")
300-
.hasSize(1)
301-
.hasOnlyOneElementSatisfying(header -> assertThat(header).isEqualTo("foo=bar; baz=qux"));
300+
.singleElement().isEqualTo("foo=bar; baz=qux");
302301
}
303302

304303
@Test

spring-test/src/test/java/org/springframework/test/context/ContextHierarchyDirtiesContextTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 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.
@@ -44,7 +44,7 @@
4444
* @author Tadaya Tsuyukubo
4545
* @since 3.2.2
4646
*/
47-
@TestMethodOrder(MethodOrderer.Alphanumeric.class)
47+
@TestMethodOrder(MethodOrderer.MethodName.class)
4848
class ContextHierarchyDirtiesContextTests {
4949

5050
private static ApplicationContext context;

spring-test/src/test/java/org/springframework/test/context/jdbc/TransactionalAfterTestMethodSqlScriptsTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 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.
@@ -39,7 +39,7 @@
3939
* @since 4.1
4040
*/
4141
@SpringJUnitConfig(EmptyDatabaseConfig.class)
42-
@TestMethodOrder(MethodOrderer.Alphanumeric.class)
42+
@TestMethodOrder(MethodOrderer.MethodName.class)
4343
@DirtiesContext
4444
class TransactionalAfterTestMethodSqlScriptsTests extends AbstractTransactionalTests {
4545

spring-test/src/test/java/org/springframework/test/context/jdbc/TransactionalSqlScriptsTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 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.
@@ -30,7 +30,7 @@
3030
* @since 4.1
3131
*/
3232
@SpringJUnitConfig(EmptyDatabaseConfig.class)
33-
@TestMethodOrder(MethodOrderer.Alphanumeric.class)
33+
@TestMethodOrder(MethodOrderer.MethodName.class)
3434
@Sql({ "schema.sql", "data.sql" })
3535
@DirtiesContext
3636
class TransactionalSqlScriptsTests extends AbstractTransactionalTests {

spring-test/src/test/java/org/springframework/test/context/transaction/ejb/AbstractEjbTxDaoTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 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.
@@ -44,7 +44,7 @@
4444
@SpringJUnitConfig
4545
@Transactional
4646
@DirtiesContext(classMode = ClassMode.AFTER_CLASS)
47-
@TestMethodOrder(MethodOrderer.Alphanumeric.class)
47+
@TestMethodOrder(MethodOrderer.MethodName.class)
4848
abstract class AbstractEjbTxDaoTests {
4949

5050
protected static final String TEST_NAME = "test-name";

spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/JavaConfigTests.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,29 +57,26 @@
5757
@ContextConfiguration(classes = JavaConfigTests.RootConfig.class),
5858
@ContextConfiguration(classes = JavaConfigTests.WebConfig.class)
5959
})
60-
public class JavaConfigTests {
60+
class JavaConfigTests {
6161

6262
@Autowired
6363
private WebApplicationContext wac;
6464

6565
@Autowired
6666
private PersonDao personDao;
6767

68-
@Autowired
69-
private PersonController personController;
70-
7168
private WebTestClient testClient;
7269

7370

7471
@BeforeEach
75-
public void setup() {
72+
void setup() {
7673
this.testClient = MockMvcWebTestClient.bindToApplicationContext(this.wac).build();
7774
given(this.personDao.getPerson(5L)).willReturn(new Person("Joe"));
7875
}
7976

8077

8178
@Test
82-
public void person() {
79+
void person() {
8380
testClient.get().uri("/person/5")
8481
.accept(MediaType.APPLICATION_JSON)
8582
.exchange()
@@ -88,7 +85,7 @@ public void person() {
8885
}
8986

9087
@Test
91-
public void tilesDefinitions() {
88+
void tilesDefinitions() {
9289
testClient.get().uri("/")
9390
.exchange()
9491
.expectStatus().isOk()
@@ -100,7 +97,7 @@ public void tilesDefinitions() {
10097
static class RootConfig {
10198

10299
@Bean
103-
public PersonDao personDao() {
100+
PersonDao personDao() {
104101
return Mockito.mock(PersonDao.class);
105102
}
106103
}
@@ -113,7 +110,7 @@ static class WebConfig implements WebMvcConfigurer {
113110
private RootConfig rootConfig;
114111

115112
@Bean
116-
public PersonController personController() {
113+
PersonController personController() {
117114
return new PersonController(this.rootConfig.personDao());
118115
}
119116

@@ -138,7 +135,7 @@ public void configureViewResolvers(ViewResolverRegistry registry) {
138135
}
139136

140137
@Bean
141-
public TilesConfigurer tilesConfigurer() {
138+
TilesConfigurer tilesConfigurer() {
142139
TilesConfigurer configurer = new TilesConfigurer();
143140
configurer.setDefinitions("/WEB-INF/**/tiles.xml");
144141
return configurer;

spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/standalone/ResponseBodyTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.test.web.servlet.samples.client.standalone;
1718

1819
import javax.validation.constraints.NotNull;
@@ -33,7 +34,7 @@
3334
*
3435
* @author Rossen Stoyanchev
3536
*/
36-
public class ResponseBodyTests {
37+
class ResponseBodyTests {
3738

3839
@Test
3940
void json() {
@@ -56,13 +57,14 @@ void json() {
5657
private static class PersonController {
5758

5859
@GetMapping("/person/{name}")
59-
public Person get(@PathVariable String name) {
60+
Person get(@PathVariable String name) {
6061
Person person = new Person(name);
6162
person.setAge(42);
6263
return person;
6364
}
6465
}
6566

67+
@SuppressWarnings("unused")
6668
private static class Person {
6769

6870
@NotNull

spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/ResponseBodyTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@
3838
* @author Rossen Stoyanchev
3939
* @author Sam Brannen
4040
*/
41-
public class ResponseBodyTests {
41+
class ResponseBodyTests {
4242

4343
@Test
44-
public void json() throws Exception {
44+
void json() throws Exception {
4545
standaloneSetup(new PersonController()).build()
4646
.perform(get("/person/Lee").accept(MediaType.APPLICATION_JSON))
4747
.andExpect(status().isOk())
@@ -60,7 +60,7 @@ public void json() throws Exception {
6060
private static class PersonController {
6161

6262
@GetMapping("/person/{name}")
63-
public Person get(@PathVariable String name) {
63+
Person get(@PathVariable String name) {
6464
Person person = new Person(name);
6565
person.setAge(42);
6666
return person;

0 commit comments

Comments
 (0)