Revisit Assert to avoid single-arg assert methods (with refined messages)
Issue: SPR-15196
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -41,10 +41,10 @@ import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*;
|
||||
/**
|
||||
* Demonstrates use of SPI extension points:
|
||||
* <ul>
|
||||
* <li> {@link org.springframework.test.web.servlet.request.RequestPostProcessor}
|
||||
* for extending request building with custom methods.
|
||||
* <li> {@link org.springframework.test.web.servlet.setup.MockMvcConfigurer
|
||||
* MockMvcConfigurer} for extending MockMvc building with some automatic setup.
|
||||
* <li> {@link org.springframework.test.web.servlet.request.RequestPostProcessor}
|
||||
* for extending request building with custom methods.
|
||||
* <li> {@link org.springframework.test.web.servlet.setup.MockMvcConfigurer
|
||||
* MockMvcConfigurer} for extending MockMvc building with some automatic setup.
|
||||
* </ul>
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
@@ -106,6 +106,7 @@ public class FrameworkExtensionTests {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test {@code MockMvcConfigurer}.
|
||||
*/
|
||||
@@ -126,6 +127,7 @@ public class FrameworkExtensionTests {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/")
|
||||
private static class SampleController {
|
||||
@@ -133,16 +135,16 @@ public class FrameworkExtensionTests {
|
||||
@RequestMapping(headers = "Foo")
|
||||
@ResponseBody
|
||||
public String handleFoo(Principal principal) {
|
||||
Assert.isTrue(principal != null);
|
||||
Assert.notNull(principal, "Principal must not be null");
|
||||
return "Foo";
|
||||
}
|
||||
|
||||
@RequestMapping(headers = "Bar")
|
||||
@ResponseBody
|
||||
public String handleBar(Principal principal) {
|
||||
Assert.isTrue(principal != null);
|
||||
Assert.notNull(principal, "Principal must not be null");
|
||||
return "Bar";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user