}
@Test
public void filterPropertyByKeyOrValueTest() throws IllegalArgumentException {
AboutModel resources = ManifestLoader.getResources();
// extract first resource
ManifestModel mm = resources.getManifests().first();
if (mm == null) {
LOGGER.log(Level.WARNING, "Unable to test with this resource name: " + resourceName
+ "\nNo resource found.");
return;
}
// extract first property
Iterator<Entry<String, String>> it = mm.getEntries().entrySet().iterator();
if (!it.hasNext()) {
LOGGER.log(Level.WARNING,
"Unable to test with this resource name which does not has properties.");
return;
}
Entry<String, String> entry = it.next();
String propertyKey = entry.getKey();
String propertyVal = entry.getValue();
// check keys
AboutModel filtered = resources.filterPropertyByKey(propertyKey);
Iterator<ManifestModel> mit = filtered.getManifests().iterator();
while (mit.hasNext()) {
final ManifestModel model = mit.next();
Assert.isTrue(model.getEntries().containsKey(propertyKey));
}
// check values
filtered = resources.filterPropertyByValue(propertyVal);
mit = filtered.getManifests().iterator();
while (mit.hasNext()) {
final ManifestModel model = mit.next();
Assert.isTrue(model.getEntries().containsValue(propertyVal));
}
}