test_class.declarator: USERNAME = "username"
test_class.modifier: private static final
test_class.original_string: private static final String USERNAME = "username";
test_class.type: String
test_class.var_name: USERNAME
test_class.declarator: PASSWORD = "password"
test_class.modifier: private static final
test_class.original_string: private static final String PASSWORD = "password";
test_class.type: String
test_class.var_name: PASSWORD
test_class.declarator: ROLE = "role"
test_class.modifier: private static final
test_class.original_string: private static final String ROLE = "role";
test_class.type: String
test_class.var_name: ROLE
test_class.declarator: mockUserService
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private UserService mockUserService;
test_class.type: UserService
test_class.var_name: mockUserService
test_class.declarator: mockAuthenticationService
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private AuthenticationService mockAuthenticationService;
test_class.type: AuthenticationService
test_class.var_name: mockAuthenticationService
test_class.declarator: mockHttpServletRequest
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private HttpServletRequest mockHttpServletRequest;
test_class.type: HttpServletRequest
test_class.var_name: mockHttpServletRequest
test_class.declarator: mockHttpServletResponse
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private HttpServletResponse mockHttpServletResponse;
test_class.type: HttpServletResponse
test_class.var_name: mockHttpServletResponse
test_class.declarator: mockUserEntity
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private UserEntity mockUserEntity;
test_class.type: UserEntity
test_class.var_name: mockUserEntity
test_class.declarator: userController
test_class.modifier: private
test_class.original_string: private UserController userController;
test_class.type: UserController
test_class.var_name: userController
test_class.file: application/confagrid-webapp/src/test/java/com/aleggeup/confagrid/user/UserControllerTest.java
test_class.identifier: UserControllerTest
test_case.body: @Test
      public void testPasswordMatch() {
          Mockito.when(mockUserService.containsName(USERNAME)).thenReturn(true);
          Mockito.when(mockAuthenticationService.userPasswordCheck(USERNAME, PASSWORD)).thenReturn(true);
          Mockito.when(mockUserEntity.getId()).thenReturn(UUID.randomUUID());
          Mockito.when(mockUserEntity.getName()).thenReturn(USERNAME);
          Mockito.when(mockAuthenticationService.authenticationToken(USERNAME, PASSWORD)).thenReturn("");
  
          Mockito.when(mockUserService.findByName(USERNAME)).thenReturn(mockUserEntity);
  
          final LoginRequest loginRequest = new LoginRequest();
          loginRequest.setName(USERNAME);
          loginRequest.setPassword(PASSWORD);
  
          boolean exceptionThrown = false;
          try {
              userController.login(loginRequest);
          } catch (final InvalidLoginException e) {
              exceptionThrown = true;
          }
  
          assertFalse(exceptionThrown);
  
          Mockito.verify(mockUserService).containsName(USERNAME);
          Mockito.verify(mockAuthenticationService).userPasswordCheck(USERNAME, PASSWORD);
          Mockito.verify(mockAuthenticationService).authenticationToken(USERNAME, PASSWORD);
          Mockito.verify(mockUserEntity).getId();
          Mockito.verify(mockUserEntity).getName();
          Mockito.verify(mockUserService).findByName(USERNAME);
      }
test_case.class_method_signature: UserControllerTest.testPasswordMatch()
test_case.full_signature: @Test public void testPasswordMatch()
test_case.identifier: testPasswordMatch
test_case.invocations: thenReturn when containsName thenReturn when userPasswordCheck thenReturn when getId randomUUID thenReturn when getName thenReturn when authenticationToken thenReturn when findByName setName setPassword login assertFalse containsName verify userPasswordCheck verify authenticationToken verify getId verify getName verify findByName verify
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPasswordMatch()
focal_class.declarator: userService
focal_class.modifier: private final
focal_class.original_string: private final UserService userService;
focal_class.type: UserService
focal_class.var_name: userService
focal_class.declarator: authenticationService
focal_class.modifier: private final
focal_class.original_string: private final AuthenticationService authenticationService;
focal_class.type: AuthenticationService
focal_class.var_name: authenticationService
focal_class.file: application/confagrid-webapp/src/main/java/com/aleggeup/confagrid/user/UserController.java
focal_class.identifier: UserController
focal_class.class_method_signature: UserController.UserController(final UserService userService, final AuthenticationService authenticationService)
focal_class.full_signature: @Autowired  UserController(final UserService userService, final AuthenticationService authenticationService)
focal_class.identifier: UserController
focal_class.modifiers: @Autowired
focal_class.parameters: (final UserService userService, final AuthenticationService authenticationService)
focal_class.signature:  UserController(final UserService userService, final AuthenticationService authenticationService)
focal_class.class_method_signature: UserController.login(@NonNull @RequestBody final LoginRequest login)
focal_class.full_signature: @RequestMapping(value = "login", method = RequestMethod.POST) public LoginResponse login(@NonNull @RequestBody final LoginRequest login)
focal_class.identifier: login
focal_class.modifiers: @RequestMapping(value = "login", method = RequestMethod.POST) public
focal_class.parameters: (@NonNull @RequestBody final LoginRequest login)
focal_class.return: LoginResponse
focal_class.signature: LoginResponse login(@NonNull @RequestBody final LoginRequest login)
focal_class.class_method_signature: UserController.check(final HttpServletResponse response)
focal_class.full_signature: @RequestMapping(value = "check", method = RequestMethod.GET) public LoginResponse check(final HttpServletResponse response)
focal_class.identifier: check
focal_class.modifiers: @RequestMapping(value = "check", method = RequestMethod.GET) public
focal_class.parameters: (final HttpServletResponse response)
focal_class.return: LoginResponse
focal_class.signature: LoginResponse check(final HttpServletResponse response)
focal_class.class_method_signature: UserController.claimContainsRole(@PathVariable final String role,
          final HttpServletRequest request)
focal_class.full_signature: @RequestMapping(value = "role/{role}", method = RequestMethod.GET) public Boolean claimContainsRole(@PathVariable final String role,
          final HttpServletRequest request)
focal_class.identifier: claimContainsRole
focal_class.modifiers: @RequestMapping(value = "role/{role}", method = RequestMethod.GET) public
focal_class.parameters: (@PathVariable final String role,
          final HttpServletRequest request)
focal_class.return: Boolean
focal_class.signature: Boolean claimContainsRole(@PathVariable final String role,
          final HttpServletRequest request)
focal_class.class_method_signature: UserController.getRoles(final Claims claims)
focal_class.full_signature: @SuppressWarnings("unchecked") private List<LinkedHashMap<String, String>> getRoles(final Claims claims)
focal_class.identifier: getRoles
focal_class.modifiers: @SuppressWarnings("unchecked") private
focal_class.parameters: (final Claims claims)
focal_class.return: List<LinkedHashMap<String, String>>
focal_class.signature: List<LinkedHashMap<String, String>> getRoles(final Claims claims)
focal_method.body: @RequestMapping(value = "login", method = RequestMethod.POST)
      public LoginResponse login(@NonNull @RequestBody final LoginRequest login) throws InvalidLoginException {
  
          if (login.getName() == null || !userService.containsName(login.getName())
              || login.getPassword() == null || login.getPassword().isEmpty()) {
              throw new InvalidLoginException();
          }
  
          if (!authenticationService.userPasswordCheck(login.getName(), login.getPassword())) {
              throw new InvalidLoginException();
          }
  
          final UserEntity userEntity = userService.findByName(login.getName());
  
          return new LoginResponse(userEntity.getId().toString(), userEntity.getName(),
              authenticationService.authenticationToken(login.getName(), login.getPassword()));
      }
focal_method.class_method_signature: UserController.login(@NonNull @RequestBody final LoginRequest login)
focal_method.full_signature: @RequestMapping(value = "login", method = RequestMethod.POST) public LoginResponse login(@NonNull @RequestBody final LoginRequest login)
focal_method.identifier: login
focal_method.invocations: getName containsName getName getPassword isEmpty getPassword userPasswordCheck getName getPassword findByName getName toString getId getName authenticationToken getName getPassword
focal_method.modifiers: @RequestMapping(value = "login", method = RequestMethod.POST) public
focal_method.parameters: (@NonNull @RequestBody final LoginRequest login)
focal_method.return: LoginResponse
focal_method.signature: LoginResponse login(@NonNull @RequestBody final LoginRequest login)