Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-tomcat</artifactId>
- <scope>provided</scope>
- </dependency>
- <parent>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-parent</artifactId>
- <version>1.4.2.RELEASE</version>
- </parent>
- @RequestMapping(value = { "/login" }, method = RequestMethod.GET)
- public @ResponseBody ResponseEntity<HashMap<String, Object>> login() {
- // some logic to get Customer
- return new ResponseEntity<>(customer, HttpStatus.OK);
- }
- @RunWith(SpringRunner.class)
- @WebMvcTest(LoginController.class)
- @SpringBootTest
- public class AuthorizationAndAuthenticationTest extends WebSecurityConfigurerAdapter {
- @Autowired
- private WebApplicationContext webApplicationContext;
- private LoginController loginController;
- @Autowired
- private TestRestTemplate restTemplate;
- @MockBean
- private LoggingService loggingService;
- @Test
- public void test() {
- given(this.loggingService.logInfoMessage("some Dummy Message", this.getClass())).
- this.restTemplate.getForObject("/login", Object.class);
- }
- }
Add Comment
Please, Sign In to add comment