List of usage examples for junit.framework Assert assertNull
static public void assertNull(Object object)
From source file:com.vmware.identity.idm.client.TenantManagementTest.java
@TestOrderAnnotation(order = 38) @Test/*from w w w .ja va2 s .c o m*/ public void testPagedSearchAgainstOpenLdap() throws Exception { Properties props = getTestProperties(); CasIdmClient idmClient = getIdmClient(); String tenantName = props.getProperty(CFG_KEY_IDM_TENANT_1_NAME); Assert.assertNotNull(tenantName); Tenant tenant = IdmClientTestUtil.ensureTenantExists(idmClient, tenantName); Assert.assertNotNull(tenant); final String olProviderName = props.getProperty(CFG_KEY_IDM_TENANT_1_OL_PROVIDER_DOMAIN_NAME); Assert.assertNotNull(olProviderName); IIdentityStoreData store = idmClient.getProvider(tenantName, olProviderName); if (store != null) { idmClient.deleteProvider(tenantName, olProviderName); store = idmClient.getProvider(tenantName, olProviderName); Assert.assertNull(store); } ensureOpenLdapIdentityStoreExistForTenant(tenantName, true); final String olDomainName = props.getProperty(CFG_KEY_IDM_TENANT_1_OL_PROVIDER_DOMAIN_NAME); Assert.assertNotNull(olDomainName); SearchCriteria allUserInPrefixedCis = new SearchCriteria("Cis", olDomainName); Set<PersonUser> allUsers = idmClient.findPersonUsers(tenantName, allUserInPrefixedCis, -1); Assert.assertEquals(2200, allUsers.size()); allUsers = idmClient.findPersonUsersByName(tenantName, allUserInPrefixedCis, -1); Assert.assertEquals(2200, allUsers.size()); SearchCriteria allGroupPrefexedCis = new SearchCriteria("CisGrp", olDomainName); Set<Group> allGroups = idmClient.findGroups(tenantName, allGroupPrefexedCis, -1); Assert.assertEquals(2200, allGroups.size()); allGroups = idmClient.findGroupsByName(tenantName, allGroupPrefexedCis, -1); Assert.assertEquals(2200, allGroups.size()); // test findGroups search is case-insensitive allGroupPrefexedCis = new SearchCriteria("cisgrp", olDomainName); allGroups = idmClient.findGroups(tenantName, allGroupPrefexedCis, -1); Assert.assertEquals(2200, allGroups.size()); // This exercise 'OL.findDisabledPersonUsers' with paged_search (it grabs all possibly users first) idmClient.findDisabledPersonUsers(tenantName, "Cis", -1); // This exercise 'OL.findLockedPersonUsers' with paged_search (it grabs all possibly users first) idmClient.findLockedUsers(tenantName, "Cis", -1); // clean up OL provider store = idmClient.getProvider(tenantName, olProviderName); if (store != null) { idmClient.deleteProvider(tenantName, olProviderName); store = idmClient.getProvider(tenantName, olProviderName); Assert.assertNull(store); } }
From source file:com.vmware.identity.idm.client.TenantManagementTest.java
@TestOrderAnnotation(order = 48) @Test/*from ww w . ja va 2 s . c om*/ public void deleteSolutionUsers() throws Exception, IDMException { CasIdmClient idmClient = getIdmClient(); Properties props = getTestProperties(); String tenantName = props.getProperty(CFG_KEY_IDM_TENANT_1_NAME); Assert.assertNotNull(tenantName); Tenant tenant = IdmClientTestUtil.ensureTenantExists(idmClient, tenantName); String userName = _solution_user_name_non_sp; SolutionUser user = idmClient.findSolutionUser(tenant.getName(), userName); Assert.assertNotNull(user); idmClient.deletePrincipal(tenant.getName(), userName); user = idmClient.findSolutionUser(tenant.getName(), userName); Assert.assertNull(user); tenantName = props.getProperty(CFG_KEY_IDM_SYSTEM_TENANT_NAME); Assert.assertNotNull(tenantName); tenant = IdmClientTestUtil.ensureTenantExists(idmClient, tenantName); userName = _solution_user_name_sp; user = idmClient.findSolutionUser(tenant.getName(), userName); Assert.assertNotNull(user); idmClient.deletePrincipal(tenant.getName(), userName); user = idmClient.findSolutionUser(tenant.getName(), userName); Assert.assertNull(user); }
From source file:com.vmware.identity.idm.client.TenantManagementTest.java
@TestOrderAnnotation(order = 49) @Test//from w ww . j av a 2s .co m public void testSetGetTenantProperties() throws Exception, IDMException { CasIdmClient idmClient = getIdmClient(); Properties props = getTestProperties(); String testTenantName = props.getProperty(CFG_KEY_IDM_TENANT_2_NAME); Assert.assertNotNull(testTenantName); IdmClientTestUtil.ensureTenantDoesNotExist(idmClient, testTenantName); Tenant tenant = IdmClientTestUtil.ensureTenantExists(idmClient, testTenantName); Assert.assertNotNull(tenant); final long clockTolerance = 20000; idmClient.setClockTolerance(testTenantName, clockTolerance); Assert.assertEquals(clockTolerance, idmClient.getClockTolerance(testTenantName)); final int delegationCount = 5; idmClient.setDelegationCount(testTenantName, delegationCount); Assert.assertEquals(delegationCount, idmClient.getDelegationCount(testTenantName)); final int renewCount = 10; idmClient.setRenewCount(testTenantName, renewCount); Assert.assertEquals(renewCount, idmClient.getRenewCount(testTenantName)); final long maxhoktoken = 30000; idmClient.setMaximumHoKTokenLifetime(testTenantName, maxhoktoken); Assert.assertEquals(maxhoktoken, idmClient.getMaximumHoKTokenLifetime(testTenantName)); final long maxbeartoken = 40000; idmClient.setMaximumBearerTokenLifetime(testTenantName, maxbeartoken); Assert.assertEquals(maxbeartoken, idmClient.getMaximumBearerTokenLifetime(testTenantName)); final long maxBearerRefreshTokenLifeTime = 40000; idmClient.setMaximumBearerRefreshTokenLifetime(testTenantName, maxBearerRefreshTokenLifeTime); Assert.assertEquals(maxbeartoken, idmClient.getMaximumBearerRefreshTokenLifetime(testTenantName)); final long maxHoKRefreshTokenLifeTime = 30000; idmClient.setMaximumHoKRefreshTokenLifetime(testTenantName, maxHoKRefreshTokenLifeTime); Assert.assertEquals(maxhoktoken, idmClient.getMaximumHoKRefreshTokenLifetime(testTenantName)); final String signatureAlgorithm = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"; idmClient.setTenantSignatureAlgorithm(testTenantName, signatureAlgorithm); Assert.assertEquals(signatureAlgorithm, idmClient.getTenantSignatureAlgorithm(testTenantName)); final String brandName = "Acme single sign-on"; idmClient.setBrandName(testTenantName, brandName); String retrievedBrand = idmClient.getBrandName(testTenantName); Assert.assertEquals(brandName, retrievedBrand); String testLogonBannerTitle = "Acme logon banner"; String testLogonBannerContent = "This is a disclaimer."; idmClient.setLogonBannerTitle(testTenantName, testLogonBannerTitle); idmClient.setLogonBannerContent(testTenantName, testLogonBannerContent); idmClient.setLogonBannerCheckboxFlag(testTenantName, true); String retrievedLogonBannerContent = idmClient.getLogonBannerContent(testTenantName); String retrievedLogonBannerTitle = idmClient.getLogonBannerTitle(testTenantName); Assert.assertEquals(retrievedLogonBannerTitle, testLogonBannerTitle); Assert.assertEquals(retrievedLogonBannerContent, testLogonBannerContent); Assert.assertTrue(idmClient.getLogonBannerCheckboxFlag(testTenantName)); final String entityId = "EntityId"; idmClient.setEntityID(testTenantName, entityId); Assert.assertEquals(entityId, idmClient.getEntityID(testTenantName)); final String alias = "vsphere.local"; idmClient.setLocalIDPAlias(testTenantName, alias); Assert.assertEquals(alias, idmClient.getLocalIDPAlias(testTenantName)); idmClient.setLocalIDPAlias(testTenantName, null); Assert.assertNull(idmClient.getLocalIDPAlias(testTenantName)); Assert.assertTrue(idmClient.isTenantIDPSelectionEnabled(testTenantName)); boolean enableIdpSelection = false; idmClient.setTenantIDPSelectionEnabled(testTenantName, enableIdpSelection); Assert.assertFalse(idmClient.isTenantIDPSelectionEnabled(testTenantName)); PasswordExpiration expiration = new PasswordExpiration(true, "a@abc.com", "Password Expired", new int[] { 1, 3, 5 }); idmClient.updatePasswordExpirationConfiguration(testTenantName, expiration); PasswordExpiration expiration1 = idmClient.getPasswordExpirationConfiguration(testTenantName); Assert.assertNotNull(expiration1); Assert.assertEquals(expiration.isEmailNotificationEnabled(), expiration1.isEmailNotificationEnabled()); Assert.assertEquals(expiration.getEmailFrom(), expiration1.getEmailFrom()); Assert.assertEquals(expiration.getEmailSubject(), expiration1.getEmailSubject()); int[] days = expiration1.getNotificationDays(); Assert.assertNotNull(days); Assert.assertEquals(expiration.getNotificationDays().length, days.length); int i = 0; for (int day : expiration.getNotificationDays()) { Assert.assertEquals(day, days[i]); i++; } // idm cert KeyStore ks = loadKeyStore(CFG_KEY_STS_KEYSTORE, CFG_KEY_STS_KEYSTORE_PASSWORD); X509Certificate cert = (X509Certificate) ks.getCertificate(props.getProperty(CFG_KEY_STS_KEY_ALIAS)); // add cert of type 'LDAP_TRUSTED_CERT' idmClient.addCertificate(testTenantName, cert, CertificateType.LDAP_TRUSTED_CERT); Collection<Certificate> idmCertificates = idmClient.getAllCertificates(testTenantName, CertificateType.LDAP_TRUSTED_CERT); Assert.assertNotNull(idmCertificates); Assert.assertEquals(1, idmCertificates.size()); X509Certificate cert1 = (X509Certificate) ks.getCertificate(props.getProperty(CFG_KEY_STS_KEY_ALIAS1)); // add cert of type 'STS_TRUSTED_CERT' idmClient.addCertificate(testTenantName, cert1, CertificateType.STS_TRUST_CERT); idmCertificates = idmClient.getAllCertificates(testTenantName, CertificateType.STS_TRUST_CERT); Assert.assertNotNull(idmCertificates); Assert.assertEquals(1, idmCertificates.size()); // delete cert of type 'LDAP_TRUSTED_CERT' idmClient.deleteCertificate(testTenantName, CertificateUtil.generateFingerprint(cert), CertificateType.LDAP_TRUSTED_CERT); idmCertificates = idmClient.getAllCertificates(testTenantName, CertificateType.LDAP_TRUSTED_CERT); Assert.assertEquals(true, ((idmCertificates == null) || (idmCertificates.size() == 0))); // should still have 'sts' trust cert idmCertificates = idmClient.getAllCertificates(testTenantName, CertificateType.STS_TRUST_CERT); Assert.assertNotNull(idmCertificates); Assert.assertEquals(1, idmCertificates.size()); // delete cert of type 'STS_TRUSTED_CERT' idmClient.deleteCertificate(testTenantName, CertificateUtil.generateFingerprint(cert1), CertificateType.STS_TRUST_CERT); idmCertificates = idmClient.getAllCertificates(testTenantName, CertificateType.STS_TRUST_CERT); Assert.assertEquals(true, ((idmCertificates == null) || (idmCertificates.size() == 0))); // default provider final String adProviderName = props.getProperty(CFG_KEY_IDM_TENANT_1_AD_PROVIDER_DOMAIN_NAME); Assert.assertNotNull(adProviderName); final String adProviderAlias = props.getProperty(CFG_KEY_IDM_TENANT_1_AD_PROVIDER_ALIAS); Assert.assertNotNull(adProviderAlias); IdentityStoreData adStore = IdmClientTestUtil.prepareADIdentityStore(idmClient, true); IIdentityStoreData store = idmClient.getProvider(testTenantName, adProviderName); // check before create if (store == null) { idmClient.addProvider(testTenantName, adStore); } // set using providerName idmClient.setDefaultProviders(testTenantName, Arrays.asList(new String[] { adProviderName })); Collection<String> providers = idmClient.getDefaultProviders(testTenantName); Assert.assertNotNull(providers); Assert.assertEquals(1, providers.size()); Assert.assertEquals(adProviderName, providers.iterator().next()); idmClient.deleteProvider(testTenantName, adProviderName); providers = idmClient.getDefaultProviders(testTenantName); Assert.assertTrue(((providers == null) || (providers.size() == 0))); store = idmClient.getProvider(testTenantName, adProviderName); // check before create if (store == null) { idmClient.addProvider(testTenantName, adStore); } // set using provider Alias Name idmClient.setDefaultProviders(testTenantName, Arrays.asList(new String[] { adProviderAlias })); providers = idmClient.getDefaultProviders(testTenantName); Assert.assertNotNull(providers); Assert.assertEquals(1, providers.size()); Assert.assertEquals(adProviderAlias, providers.iterator().next()); idmClient.setDefaultProviders(testTenantName, null); providers = idmClient.getDefaultProviders(testTenantName); Assert.assertTrue(((providers == null) || (providers.size() == 0))); idmClient.deleteProvider(testTenantName, adProviderAlias); providers = idmClient.getDefaultProviders(testTenantName); Assert.assertTrue(((providers == null) || (providers.size() == 0))); // default tenant String defaultTenant = idmClient.getDefaultTenant(); idmClient.setDefaultTenant(testTenantName); Assert.assertEquals(testTenantName, idmClient.getDefaultTenant()); idmClient.deleteTenant(testTenantName); String defTenant = idmClient.getDefaultTenant(); Assert.assertTrue((defTenant == null) || (defTenant.isEmpty())); if ((defaultTenant != testTenantName) && (defaultTenant != null) && (defaultTenant.isEmpty() == false)) { idmClient.setDefaultTenant(defaultTenant); Assert.assertEquals(defaultTenant, idmClient.getDefaultTenant()); } }
From source file:com.vmware.identity.idm.client.TenantManagementTest.java
@TestOrderAnnotation(order = 51) @Test//from ww w.ja va 2 s . c om public void testDeleteIdentityStore() throws Exception, IDMException { CasIdmClient idmClient = getIdmClient(); Properties props = getTestProperties(); String tenantName = props.getProperty(CFG_KEY_IDM_TENANT_1_NAME); Assert.assertNotNull(tenantName); Tenant tenant = IdmClientTestUtil.ensureTenantExists(idmClient, tenantName); Assert.assertNotNull(tenant); final String storeName = props.getProperty(CFG_KEY_IDM_TENANT_1_AD_PROVIDER_DOMAIN_NAME); Assert.assertNotNull(storeName); IIdentityStoreData store = idmClient.getProvider(tenantName, storeName); Assert.assertNotNull(store); idmClient.deleteProvider(tenantName, storeName); store = idmClient.getProvider(tenantName, storeName); Assert.assertNull(store); final String olProviderName = props.getProperty(CFG_KEY_IDM_TENANT_1_OL_PROVIDER_DOMAIN_NAME); Assert.assertNotNull(olProviderName); final String olProviderAlias = props.getProperty(CFG_KEY_IDM_TENANT_1_OL_PROVIDER_ALIAS); Assert.assertNotNull(olProviderAlias); store = idmClient.getProvider(tenantName, olProviderName); if (store != null) { idmClient.deleteProvider(tenantName, olProviderName); store = idmClient.getProvider(tenantName, olProviderName); Assert.assertNull(store); } ensureOpenLdapIdentityStoreExistForTenant(tenantName, true); store = idmClient.getProvider(tenantName, olProviderName); Assert.assertNotNull(store); Assert.assertEquals(olProviderName, store.getName()); Assert.assertNotNull(store.getExtendedIdentityStoreData()); Assert.assertNotNull(olProviderAlias, store.getExtendedIdentityStoreData().getAlias()); idmClient.deleteProvider(tenantName, olProviderAlias); store = idmClient.getProvider(tenantName, olProviderName); Assert.assertNull(store); store = idmClient.getProvider(tenantName, olProviderAlias); Assert.assertNull(store); }
From source file:fragment.web.AbstractProductsControllerTest.java
@Test public void testEditProductsLogo() throws Exception { Product product = productService.locateProduct("1", false); Assert.assertNull(product.getImagePath()); ProductLogoForm form = new ProductLogoForm(product); MultipartFile logo = new MockMultipartFile("Product.jpeg", "Product.jpeg", "bytes", "ProductLogo".getBytes()); form.setLogo(logo);//from w w w . ja va2 s. co m BindingResult result = validate(form); Assert.assertNotNull(result); File currentDirectory = new File(new File(".").getAbsolutePath()); String currentDirectoryPath = ""; Configuration rootdir = configurationService .locateConfigurationByName(Names.com_citrix_cpbm_portal_settings_images_uploadPath); try { currentDirectoryPath = currentDirectory.getCanonicalPath(); } catch (IOException e1) { e1.printStackTrace(); Assert.fail(); } rootdir.setValue(currentDirectoryPath); configurationService.update(rootdir); Assert.assertNull(product.getImagePath()); productsController.editProductLogo(form, result, request, map); product = productService.locateProduct("1", false); Assert.assertNotNull(product.getImagePath()); String productsAbsoluteDir = FilenameUtils.concat(currentDirectoryPath, "products"); Assert.assertEquals(product.getImagePath().replace("/", "\\"), "products\\1\\Product.jpeg"); File dir = new File(productsAbsoluteDir); try { org.apache.commons.io.FileUtils.deleteDirectory(dir); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.vmware.identity.idm.client.TenantManagementTest.java
@TestOrderAnnotation(order = 52) @Test/* w w w . j av a 2s.c o m*/ public void testDeleteRelyingParty() throws Exception, IDMException { CasIdmClient idmClient = getIdmClient(); Properties props = getTestProperties(); String tenantName = props.getProperty(CFG_KEY_IDM_TENANT_1_NAME); Assert.assertNotNull(tenantName); Tenant tenant = IdmClientTestUtil.ensureTenantExists(idmClient, tenantName); Assert.assertNotNull(tenant); String rpName = "coke"; //test deleting rp that exist for the tenant RelyingParty rp = idmClient.getRelyingParty(tenantName, rpName); Assert.assertNotNull(rp); idmClient.deleteRelyingParty(tenantName, rpName); rp = idmClient.getRelyingParty(tenantName, rpName); Assert.assertNull(rp); //test non-exist relying party try { idmClient.deleteRelyingParty(tenantName, rpName); Assert.fail("fail to throw NoSuchRelyingPartyException"); } catch (NoSuchRelyingPartyException ex) { //succeeded } }
From source file:com.vmware.identity.idm.client.TenantManagementTest.java
private void AssertClientCertPolicy(ClientCertPolicy certIn, ClientCertPolicy certOut) { Assert.assertEquals(certIn.revocationCheckEnabled(), certOut.revocationCheckEnabled()); Assert.assertEquals(certIn.useCRLAsFailOver(), certOut.useCRLAsFailOver()); Assert.assertEquals(certIn.sendOCSPNonce(), certOut.sendOCSPNonce()); Assert.assertEquals(certIn.getOCSPUrl(), certOut.getOCSPUrl()); Assert.assertEquals(certIn.getOCSPResponderSigningCert(), certOut.getOCSPResponderSigningCert()); Assert.assertEquals(certIn.useCertCRL(), certOut.useCertCRL()); Assert.assertEquals(certIn.getCRLUrl(), certOut.getCRLUrl()); Assert.assertEquals(certIn.getCacheSize(), certOut.getCacheSize()); if (certIn.get_siteOCSPList() != null) { Assert.assertTrue(certIn.get_siteOCSPList().equals(certOut.get_siteOCSPList())); }//from www. j av a 2 s .c o m //OIDs if (certIn.getOIDs() == null) { Assert.assertNull(certOut.getOIDs()); } else { Assert.assertNotNull(certOut.getOIDs()); Assert.assertEquals(certIn.getOIDs().length, certOut.getOIDs().length); for (String s : certIn.getOIDs()) { Assert.assertTrue(ArrayUtils.contains(certOut.getOIDs(), s)); } } //trusted CAs if (certIn.getTrustedCAs() == null || certIn.getTrustedCAs().length == 0) { Assert.assertNull(certOut.getTrustedCAs()); } else { Assert.assertNotNull(certOut.getTrustedCAs()); Assert.assertEquals(certIn.getTrustedCAs().length, certOut.getTrustedCAs().length); for (int i = 0; i < certIn.getTrustedCAs().length; i++) { Assert.assertEquals(certIn.getTrustedCAs()[i], certOut.getTrustedCAs()[i]); } } }
From source file:android.support.mediacompat.service.StubMediaBrowserServiceCompat.java
@Override public void onLoadChildren(final String parentMediaId, final Result<List<MediaItem>> result) { List<MediaItem> mediaItems = new ArrayList<>(); if (MEDIA_ID_ROOT.equals(parentMediaId)) { Bundle rootHints = getBrowserRootHints(); for (String id : MEDIA_ID_CHILDREN) { mediaItems.add(createMediaItem(id)); }//from w w w. ja v a 2 s . co m result.sendResult(mediaItems); } else if (MEDIA_ID_CHILDREN_DELAYED.equals(parentMediaId)) { Assert.assertNull(mPendingLoadChildrenResult); mPendingLoadChildrenResult = result; mPendingRootHints = getBrowserRootHints(); result.detach(); } else if (MEDIA_ID_INVALID.equals(parentMediaId)) { result.sendResult(null); } }
From source file:nu.mine.kino.projects.ExcelProjectCreatorTest.java
private void checkEV(TaskInformation[] infos) { System.out.println("--- check EV ----"); for (TaskInformation info : infos) { System.out.printf("%s:%s\n", info.getTaskId(), info.getEV().getEarnedValue()); }// w w w. ja v a2s.co m TaskInformation target = null; double progressRate = Double.NaN; // #L?A?sf?[^P?[X target = infos[0]; Assert.assertEquals(Double.NaN, target.getEV().getEarnedValue()); Assert.assertEquals(Double.NaN, target.getEV().getProgressRate()); Assert.assertNull(target.getEV().getStartDate()); Assert.assertNull(target.getEV().getEndDate()); // ?P?[X target = infos[6]; progressRate = 0.8; Assert.assertEquals(0.5 * progressRate, target.getEV().getEarnedValue());// 0.4 Assert.assertEquals(progressRate, target.getEV().getProgressRate()); Assert.assertEquals(Utils.str2Date("2014/11/04"), target.getEV().getStartDate()); Assert.assertNull("getEndDatenull", target.getEV().getEndDate()); // ?P?[X target = infos[2]; progressRate = 0.5; Assert.assertEquals(1.0 * progressRate, target.getEV().getEarnedValue());// 0.5 Assert.assertEquals(progressRate, target.getEV().getProgressRate()); Assert.assertEquals(Utils.str2Date("2014/11/04"), target.getEV().getStartDate()); Assert.assertNull("getEndDatenull", target.getEV().getEndDate()); // ?P?[X ?iJnP?[X target = infos[3]; progressRate = 0.0; Assert.assertEquals(0.5 * progressRate, target.getEV().getEarnedValue());// 0.0 Assert.assertEquals(Double.NaN, target.getEV().getProgressRate()); // NaN Assert.assertNull("getStartDatenull", target.getEV().getStartDate()); Assert.assertNull("getEndDatenull", target.getEV().getEndDate()); // ?P?[X target = infos[7]; progressRate = 1.0; Assert.assertEquals(0.5 * progressRate, target.getEV().getEarnedValue());// 0.4 Assert.assertEquals(progressRate, target.getEV().getProgressRate()); Assert.assertEquals(Utils.str2Date("2014/11/04"), target.getEV().getStartDate()); Assert.assertEquals(Utils.str2Date("2014/11/04"), target.getEV().getEndDate()); }
From source file:org.aksw.simba.tapioca.server.PreprocessingTest.java
@Test public void test() throws IOException { Vocabulary vocabulary = new SimpleVocabulary(); SingleDocumentPreprocessor preprocessor = TMEngine .createPreprocessing(new WorkerBasedLabelRetrievingDocumentSupplierDecorator(null, new File[] { File.createTempFile("test_", "") }), vocabulary); String voidString = readVoidString(file); Document document = new Document(); document.addProperty(new DocumentText(voidString)); document = preprocessor.processDocument(document); if (expectedWords == null) { Assert.assertNull(document); return;//from ww w . j av a 2 s . c o m } Assert.assertNotNull(document); System.out.println(document.toString()); DocumentWordCounts wordCounts = document.getProperty(DocumentWordCounts.class); Assert.assertNotNull(wordCounts); int wordId; for (int i = 0; i < expectedWords.length; ++i) { wordId = vocabulary.getId(expectedWords[i]); Assert.assertTrue( "The expected word \"" + expectedWords[i] + "\" couldn't be found inside the vocabulary.", wordId != Vocabulary.WORD_NOT_FOUND); Assert.assertEquals( "Counts (" + wordCounts.getCountForWord(wordId) + ") for word " + expectedWords[i] + " do not equal the expected counts (" + expectedCounts[i] + ").", expectedCounts[i], wordCounts.getCountForWord(wordId)); } }