@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())); }