@Test
  public void testGetCertificationsWithRankedOnTop() {
    List<CertificationType> certifications = Lists.newArrayList();
    Certification cert = CredentialFactory.getInstance().createCertification();
    Certification rankedCert = CredentialFactory.getInstance().createCertification();
    certifications.add(cert.getCertificationType());
    certifications.add(rankedCert.getCertificationType());
    List<CertificationType> rankedCertifications = Lists.newArrayList();
    rankedCertifications.add(rankedCert.getCertificationType());

    when(mockDataService.getAllSorted(CertificationType.class)).thenReturn(certifications);
    when(mockDataService.getAllRanked(CertificationType.class)).thenReturn(rankedCertifications);

    List<CertificationType> expectedCertifications = Lists.newArrayList(rankedCertifications);
    expectedCertifications.addAll(certifications);
    assertEquals(expectedCertifications, action.getCertificationsWithRankedOnTop());
  }
  @Test
  public void testCertificationGetters() {
    Certification credential = CredentialFactory.getInstance().createCertification();
    credential.getCertificationType().setId(1L);

    action.setCredential(new Degree());
    assertNull(action.getCertification());

    action.setCertification(new Certification());

    when(mockDataService.getPersistentObject(CertificationType.class, null)).thenReturn(null);
    when(mockDataService.getPersistentObject(CertificationType.class, 1L))
        .thenReturn(credential.getCertificationType());

    action.setCertificationTypeId(null);
    assertNull(action.getCertificationTypeId());
    action.setCertificationTypeId(1L);
    assertEquals(Long.valueOf(1L), action.getCertificationTypeId());
  }
 @Test
 public void testGetRankedCertifications() {
   List<CertificationType> certifications = new ArrayList<CertificationType>();
   Certification cert1 = CredentialFactory.getInstance().createCertification();
   Certification cert2 = CredentialFactory.getInstance().createCertification();
   Certification cert3 = CredentialFactory.getInstance().createCertification();
   certifications.add(cert1.getCertificationType());
   certifications.add(cert2.getCertificationType());
   certifications.add(cert3.getCertificationType());
   when(mockDataService.getAllRanked(CertificationType.class)).thenReturn(certifications);
   List<CertificationType> rankedCertifications = action.getRankedCertifications();
   assertNotNull(rankedCertifications);
   assertEquals(3, rankedCertifications.size());
   assertTrue(rankedCertifications.contains(cert1.getCertificationType()));
   assertTrue(rankedCertifications.contains(cert2.getCertificationType()));
   assertTrue(rankedCertifications.contains(cert3.getCertificationType()));
 }