Guest User

Untitled

a guest
Dec 8th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. <dependency>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-test</artifactId>
  4. </dependency>
  5.  
  6. <dependency>
  7. <groupId>org.springframework.boot</groupId>
  8. <artifactId>spring-boot-starter-tomcat</artifactId>
  9. <scope>provided</scope>
  10. </dependency>
  11.  
  12. <parent>
  13. <groupId>org.springframework.boot</groupId>
  14. <artifactId>spring-boot-starter-parent</artifactId>
  15. <version>1.4.2.RELEASE</version>
  16. </parent>
  17.  
  18. @RequestMapping(value = { "/login" }, method = RequestMethod.GET)
  19. public @ResponseBody ResponseEntity<HashMap<String, Object>> login() {
  20.  
  21.  
  22. // some logic to get Customer
  23. return new ResponseEntity<>(customer, HttpStatus.OK);
  24.  
  25. }
  26.  
  27. @RunWith(SpringRunner.class)
  28. @WebMvcTest(LoginController.class)
  29. @SpringBootTest
  30. public class AuthorizationAndAuthenticationTest extends WebSecurityConfigurerAdapter {
  31.  
  32. @Autowired
  33. private WebApplicationContext webApplicationContext;
  34. private LoginController loginController;
  35. @Autowired
  36. private TestRestTemplate restTemplate;
  37.  
  38. @MockBean
  39. private LoggingService loggingService;
  40.  
  41. @Test
  42. public void test() {
  43. given(this.loggingService.logInfoMessage("some Dummy Message", this.getClass())).
  44. this.restTemplate.getForObject("/login", Object.class);
  45. }
  46. }
Add Comment
Please, Sign In to add comment