TrustServiceProviderByTSPName implements TrustServiceProviderPredicate { @Override public boolean test(TSPType trustServiceProvider) { if (trustServiceProvider != null && Utils.isStringNotEmpty(tspName)) { TSPInformationType tspInformation = trustServiceProvider.getTSPInformation(); InternationalNamesType currentTspNames = tspInformation.getTSPName(); for (MultiLangNormStringType name : currentTspNames.getName()) { if (Utils.areStringsEqualIgnoreCase(tspName, name.getValue())) { return true; } } } return false; } TrustServiceProviderByTSPName(String tspName); @Override boolean test(TSPType trustServiceProvider);  }
@Test void test() throws Exception { File fileToTest = new File("src/test/resources/fr.xml"); TrustStatusListType trustStatusList = TrustedListFacade.newFacade().unmarshall(fileToTest); TrustServiceProviderListType trustServiceProviderList = trustStatusList.getTrustServiceProviderList(); List<TSPType> trustServiceProvider = trustServiceProviderList.getTrustServiceProvider(); TSPType tspType = trustServiceProvider.get(0); TrustServiceProviderByTSPName selector = new TrustServiceProviderByTSPName("test"); assertFalse(selector.test(tspType)); selector = new TrustServiceProviderByTSPName("Agence Nationale des Titres Sécurisés"); assertTrue(selector.test(tspType)); assertFalse(selector.test(null)); selector = new TrustServiceProviderByTSPName(null); assertFalse(selector.test(tspType)); assertFalse(selector.test(null)); }