### Question:
UserOrgServiceImpl implements UserOrgService { @Override @Transactional public ProfileDTO saveUserOrgInfo(ProfileDTO profile, Authentication authentication) { String userId = authentication.getName(); UserOrg userOrg = getUserOrgForUserId(userId); boolean userOrgCreated = false; if (userOrg == null) { log.debug("Creating userOrg for [{}]", userId); userOrg = createUserOrgForUser(userId); userOrgCreated = true; } log.info("Updating userOrg for [{}]", userId); userOrg = updateUserOrg(profile, userOrg); boolean userOrgTransactionSuccess = true; try { userOrg = saveUserOrgTransaction(userOrg, authentication); } catch (MuleException e) { log.error("UserOrg for user [{}] was not saved. {}", userId, e); userOrgTransactionSuccess = false; } getEventPublisher().publishProfileEvent(userOrg, authentication, userOrgCreated, userOrgTransactionSuccess); return profile; }  @Override UserOrg getUserOrgForUserId(String userId); @Override String getProfileLocation(); @Override @Transactional UserOrg saveUserOrgTransaction(UserOrg userOrgInfo, Authentication authentication); @Override @Transactional ProfileDTO getProfileInfo(String userId, Authentication authentication); @Override @Transactional ProfileDTO saveUserOrgInfo(ProfileDTO profile, Authentication authentication); UserDao getUserDao(); void setUserDao(UserDao userDao); OrganizationService getOrganizationService(); void setOrganizationService(OrganizationService organizationService); UserOrgDao getUserOrgDao(); void setUserOrgDao(UserOrgDao userOrgDao); MuleContextManager getMuleContextManager(); void setMuleContextManager(MuleContextManager muleContextManager); ProfileEventPublisher getEventPublisher(); void setEventPublisher(ProfileEventPublisher eventPublisher); AcmGroupDao getGroupDao(); void setGroupDao(AcmGroupDao groupDao); GroupService getGroupService(); void setGroupService(GroupService groupService); String getDefaultCmisId(); void setDefaultCmisId(String defaultCmisId); ProfileConfig getProfileConfig(); void setProfileConfig(ProfileConfig profileConfig);  }### Answer:
@Test public void saveUserOrgInfoWhenCompanyNameIsWhiteSpaceOnlyAndUserOrgExists() throws MuleException { ProfileDTO profileDTO = createMockProfileDTO(); profileDTO.setCompanyName(" "); UserOrg userOrg = createAndSetUserOrg(); expectWhenUpdateUserOrgSuccessfully(userOrg); mockEventPublisher.publishProfileEvent(userOrg, mockAuthentication, false, true); expectLastCall().once(); replayAll(); userOrgService.saveUserOrgInfo(profileDTO, mockAuthentication); verifyAll(); verifyUserOrgIsPopulated(userOrg, profileDTO); assertNull(userOrg.getOrganization()); }
@Test public void saveUserOrgInfoWhenCompanyNameNotBlankAndUserOrgExists() throws MuleException { ProfileDTO profileDTO = createMockProfileDTO(); UserOrg userOrg = createAndSetUserOrg(); expectWhenUpdateUserOrgSuccessfully(userOrg); expect(mockOrganizationService.findOrCreateOrganization(COMPANY_NAME, USER_ID)) .andReturn(userOrg.getOrganization()); mockEventPublisher.publishProfileEvent(userOrg, mockAuthentication, false, true); expectLastCall().once(); replayAll(); userOrgService.saveUserOrgInfo(profileDTO, mockAuthentication); verifyAll(); verifyUserOrgIsPopulated(userOrg, profileDTO); }