test_class.declarator: userDetailsService
test_class.modifier: private
test_class.original_string: private UserDetailsService userDetailsService;
test_class.type: UserDetailsService
test_class.var_name: userDetailsService
test_class.file: modules/flowable-spring-security/src/test/java/org/flowable/spring/security/FlowableUserDetailsServiceTest.java
test_class.identifier: FlowableUserDetailsServiceTest
test_class.superclass: extends PluggableFlowableIdmTestCase
test_case.body: @Test
      public void testSerializingUserDetailsShouldWorkCorrectly() throws IOException, ClassNotFoundException {
          UserDetails kermit = userDetailsService.loadUserByUsername("kermit");
  
          byte[] serialized;
          ByteArrayOutputStream buffer = new ByteArrayOutputStream();
          ObjectOutputStream outputStream = new ObjectOutputStream(buffer);
          outputStream.writeObject(kermit);
          outputStream.close();
          serialized = buffer.toByteArray();
  
          ByteArrayInputStream inputStream = new ByteArrayInputStream(serialized);
          ObjectInputStream stream = new ObjectInputStream(inputStream);
          Object deserialized = stream.readObject();
          stream.close();
  
          assertThat(deserialized).isInstanceOf(FlowableUserDetails.class);
  
          kermit = (UserDetails) deserialized;
          assertThat(kermit.isCredentialsNonExpired()).as("credentialsNonExpired").isTrue();
          assertThat(kermit.isAccountNonLocked()).as("accountNonLocked").isTrue();
          assertThat(kermit.isAccountNonExpired()).as("accountNonExpired").isTrue();
          assertThat(kermit.isEnabled()).as("enabled").isTrue();
          assertThat(kermit.getUsername()).as("username").isEqualTo("kermit");
          assertThat(kermit.getPassword()).as("password").isEqualTo("kermit");
          assertThat(kermit.getAuthorities())
              .extracting(GrantedAuthority::getAuthority)
              .as("granted authorities")
              .containsExactly(
                  "access admin application",
                  "access modeler application",
                  "start processes"
              );
  
          FlowableUserDetails kermitFlowable = (FlowableUserDetails) kermit;
  
          User user = kermitFlowable.getUser();
          assertThat(user.getId()).isEqualTo("kermit");
          assertThat(user.getFirstName()).isEqualTo("Kermit");
          assertThat(user.getLastName()).isEqualTo("the Frog");
          assertThat(user.getDisplayName()).isEqualTo("Kermit the Frog");
          assertThat(user.getEmail()).isEqualTo("kermit@muppetshow.com");
          assertThat(user.getPassword()).isEqualTo("kermit");
  
          assertThat(kermitFlowable.getGroups())
              .extracting(Group::getId, Group::getName, Group::getType)
              .as("Groups")
              .containsExactlyInAnyOrder(
                  tuple("admins", "Admins", "user"),
                  tuple("sales", "Sales", "user"),
                  tuple("engineering", "Engineering", "tech")
              );
      }
test_case.class_method_signature: FlowableUserDetailsServiceTest.testSerializingUserDetailsShouldWorkCorrectly()
test_case.full_signature: @Test public void testSerializingUserDetailsShouldWorkCorrectly()
test_case.identifier: testSerializingUserDetailsShouldWorkCorrectly
test_case.invocations: loadUserByUsername writeObject close toByteArray readObject close isInstanceOf assertThat isTrue as assertThat isCredentialsNonExpired isTrue as assertThat isAccountNonLocked isTrue as assertThat isAccountNonExpired isTrue as assertThat isEnabled isEqualTo as assertThat getUsername isEqualTo as assertThat getPassword containsExactly as extracting assertThat getAuthorities getUser isEqualTo assertThat getId isEqualTo assertThat getFirstName isEqualTo assertThat getLastName isEqualTo assertThat getDisplayName isEqualTo assertThat getEmail isEqualTo assertThat getPassword containsExactlyInAnyOrder as extracting assertThat getGroups tuple tuple tuple
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSerializingUserDetailsShouldWorkCorrectly()
focal_class.declarator: identityService
focal_class.modifier: protected final
focal_class.original_string: protected final IdmIdentityService identityService;
focal_class.type: IdmIdentityService
focal_class.var_name: identityService
focal_class.file: modules/flowable-spring-security/src/main/java/org/flowable/spring/security/FlowableUserDetailsService.java
focal_class.identifier: FlowableUserDetailsService
focal_class.interfaces: implements UserDetailsService
focal_class.class_method_signature: FlowableUserDetailsService.FlowableUserDetailsService(IdmIdentityService identityService)
focal_class.full_signature: public  FlowableUserDetailsService(IdmIdentityService identityService)
focal_class.identifier: FlowableUserDetailsService
focal_class.modifiers: public
focal_class.parameters: (IdmIdentityService identityService)
focal_class.signature:  FlowableUserDetailsService(IdmIdentityService identityService)
focal_class.class_method_signature: FlowableUserDetailsService.loadUserByUsername(String userId)
focal_class.full_signature: @Override public UserDetails loadUserByUsername(String userId)
focal_class.identifier: loadUserByUsername
focal_class.modifiers: @Override public
focal_class.parameters: (String userId)
focal_class.return: UserDetails
focal_class.signature: UserDetails loadUserByUsername(String userId)
focal_class.class_method_signature: FlowableUserDetailsService.createFlowableUser(User user)
focal_class.full_signature: protected FlowableUser createFlowableUser(User user)
focal_class.identifier: createFlowableUser
focal_class.modifiers: protected
focal_class.parameters: (User user)
focal_class.return: FlowableUser
focal_class.signature: FlowableUser createFlowableUser(User user)
focal_method.body: @Override
      public UserDetails loadUserByUsername(String userId)
              throws UsernameNotFoundException {
          User user = null;
          try {
              user = this.identityService.createUserQuery()
                      .userId(userId)
                      .singleResult();
          } catch (FlowableException ex) {
              // don't care
          }
  
          if (null == user) {
              throw new UsernameNotFoundException(
                      String.format("user (%s) could not be found", userId));
          }
  
          return createFlowableUser(user);
      }
focal_method.class_method_signature: FlowableUserDetailsService.loadUserByUsername(String userId)
focal_method.full_signature: @Override public UserDetails loadUserByUsername(String userId)
focal_method.identifier: loadUserByUsername
focal_method.invocations: singleResult userId createUserQuery format createFlowableUser
focal_method.modifiers: @Override public
focal_method.parameters: (String userId)
focal_method.return: UserDetails
focal_method.signature: UserDetails loadUserByUsername(String userId)