test_class.declarator: service
test_class.modifier: private
test_class.original_string: private ProfileFromItsKdeWhoService service;
test_class.type: ProfileFromItsKdeWhoService
test_class.var_name: service
test_class.file: eu.alert-project.iccs.stardom.core/eu.alert-project.iccs.stardom.analyzers/eu.alert-project.iccs.startdom.analyzers.its/src/test/java/eu/alertproject/iccs/stardom/analyzers/its/internal/ProfileFromItsKdeWhoServiceTest.java
test_class.identifier: ProfileFromItsKdeWhoServiceTest
test_case.body: @Test
      public void testNone(){
  
          Profile p = new Profile();
          p.setName("None");
          p.setLastname("None");
          p.setUsername("None");
          p.setEmail("None");
          p.setSource("None");
          p.setSourceId("None");
  
          Profile generate = service.generate(p);
  
          Assert.assertNull(generate.getName());
          Assert.assertNull(generate.getLastname());
          Assert.assertNull(generate.getUsername());
          Assert.assertNull(generate.getEmail());
  
  
  
      }
test_case.class_method_signature: ProfileFromItsKdeWhoServiceTest.testNone()
test_case.full_signature: @Test public void testNone()
test_case.identifier: testNone
test_case.invocations: setName setLastname setUsername setEmail setSource setSourceId generate assertNull getName assertNull getLastname assertNull getUsername assertNull getEmail
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testNone()
focal_class.declarator: logger = LoggerFactory.getLogger(ProfileFromItsKdeWhoService.class)
focal_class.modifier: private
focal_class.original_string: private Logger logger = LoggerFactory.getLogger(ProfileFromItsKdeWhoService.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.file: eu.alert-project.iccs.stardom.core/eu.alert-project.iccs.stardom.analyzers/eu.alert-project.iccs.startdom.analyzers.its/src/main/java/eu/alertproject/iccs/stardom/analyzers/its/internal/ProfileFromItsKdeWhoService.java
focal_class.identifier: ProfileFromItsKdeWhoService
focal_class.class_method_signature: ProfileFromItsKdeWhoService.generate(Profile dirty)
focal_class.full_signature: public Profile generate(Profile dirty)
focal_class.identifier: generate
focal_class.modifiers: public
focal_class.parameters: (Profile dirty)
focal_class.return: Profile
focal_class.signature: Profile generate(Profile dirty)
focal_method.body: public Profile generate(Profile dirty){
  
          String name = StringUtils.trimToEmpty(dirty.getName());
          String email = StringUtils.trimToEmpty(dirty.getEmail());
  
          Profile profile = new Profile();
          profile.setUsername(dirty.getUsername());
          profile.setEmail(email);
          profile.setSourceId(dirty.getSourceId());
  
          /**
           * 1.) Names are composed of a single word, the rest is the last name
           */
          Pattern p = Pattern.compile("([\\p{L}\\w\\?-]+) *([\\p{L}\\w\\?\\.\\d=\\\\ -]+)?");
  
          Matcher matcher = p.matcher(name);
  
          logger.trace("Profile generate() {} ",name,email);
  
          if(matcher.matches()){
              logger.trace("Profile generate() ************* MATCHES ***************");
  
              profile.setName(matcher.group(1));
              profile.setLastname(matcher.group(2));
  
          }else{
              logger.trace("Profile generate() ----------------   NOT MATCHED");
              profile.setName(null);
              profile.setLastname(null);
          }
  
  
  
          //check none
          if(StringUtils.trimToEmpty(profile.getName()).toLowerCase().equals("none")){
              profile.setName(null);
          }
          if(StringUtils.trimToEmpty(profile.getLastname()).toLowerCase().equals("none")){
              profile.setLastname(null);
          }
  
          if(StringUtils.trimToEmpty(profile.getUsername()).toLowerCase().equals("none")){
              profile.setUsername(null);
          }
  
          if(StringUtils.trimToEmpty(profile.getEmail()).toLowerCase().equals("none")){
              profile.setEmail(null);
          }
  
  
          logger.trace("Profile generate() Returning {} ",profile);
          return profile;
  
      }
focal_method.class_method_signature: ProfileFromItsKdeWhoService.generate(Profile dirty)
focal_method.full_signature: public Profile generate(Profile dirty)
focal_method.identifier: generate
focal_method.invocations: trimToEmpty getName trimToEmpty getEmail setUsername getUsername setEmail setSourceId getSourceId compile matcher trace matches trace setName group setLastname group trace setName setLastname equals toLowerCase trimToEmpty getName setName equals toLowerCase trimToEmpty getLastname setLastname equals toLowerCase trimToEmpty getUsername setUsername equals toLowerCase trimToEmpty getEmail setEmail trace
focal_method.modifiers: public
focal_method.parameters: (Profile dirty)
focal_method.return: Profile
focal_method.signature: Profile generate(Profile dirty)