### Question:
TokensApiController implements TokensApi { @PreAuthorize("hasAuthority('VIEW_KEYS')") @Override public ResponseEntity<List<Token>> getTokens() { List<TokenInfo> tokenInfos = tokenService.getAllTokens(); List<Token> tokens = tokenConverter.convert(tokenInfos); return new ResponseEntity<>(tokens, HttpStatus.OK); } @Autowired  TokensApiController(TokenService tokenService,
            TokenConverter tokenConverter); @PreAuthorize("hasAuthority('VIEW_KEYS')") @Override ResponseEntity<List<Token>> getTokens(); @Override @PreAuthorize("hasAuthority('VIEW_KEYS')") ResponseEntity<Token> getToken(String id); @PreAuthorize("hasAuthority('ACTIVATE_TOKEN')") @Override ResponseEntity<Token> loginToken(String id, TokenPassword tokenPassword); @PreAuthorize("hasAuthority('DEACTIVATE_TOKEN')") @Override ResponseEntity<Token> logoutToken(String id);  }### Answer:
@Test @WithMockUser(authorities = { "VIEW_KEYS" }) public void getTokens() { ResponseEntity<List<Token>> response = tokensApiController.getTokens(); assertEquals(HttpStatus.OK, response.getStatusCode()); List<Token> tokens = response.getBody(); assertEquals(1, tokens.size()); Token token = tokens.iterator().next(); assertEquals(TokenStatus.OK, token.getStatus()); assertEquals("friendly-name", token.getName()); }