Exemplo n.º 1
0
 private static Candidate createCandidate(Map<String, String> beanAttr) {
   if (beanAttr == null) return null;
   Candidate candidate = new Candidate();
   candidate.setAttributes(BeansUtils.deserializeStringToMap(beanAttr.get("attributes")));
   // Parse and get ExtSource
   UserExtSource userExtSource;
   if (beanAttr.get("userExtSource").equals("\\0")) userExtSource = null;
   else {
     List<Pair<String, Map<String, String>>> userExtSourceMap =
         beansToMap(beanAttr.get("userExtSource"));
     userExtSource = createUserExtSource(userExtSourceMap.get(0).getRight());
   }
   candidate.setUserExtSource(userExtSource);
   // Parse and get list of UserExtSources
   List<UserExtSource> additionalUserExtSources = new ArrayList<UserExtSource>();
   if (beanAttr.get("additionalUserExtSources").equals("\\0")) additionalUserExtSources = null;
   else {
     List<Pair<String, Map<String, String>>> userExtSourcesList =
         beansToMap(beanAttr.get("additionalUserExtSources"));
     for (Pair<String, Map<String, String>> p : userExtSourcesList) {
       userExtSource = createUserExtSource(p.getRight());
       additionalUserExtSources.add(userExtSource);
     }
   }
   candidate.setAdditionalUserExtSources(additionalUserExtSources);
   return candidate;
 }
  private Candidate setUpCandidate2() {

    Candidate candidate = new Candidate(); // Mockito.mock(Candidate.class);
    candidate.setFirstName("aaa2");
    candidate.setId(0);
    candidate.setMiddleName("");
    candidate.setLastName("bbb2");
    candidate.setTitleBefore("");
    candidate.setTitleAfter("");
    final UserExtSource userExtSource = new UserExtSource(extSource, extLogin2);
    candidate.setUserExtSource(userExtSource);
    candidate.setAttributes(new HashMap<String, String>());
    return candidate;
  }