List<IContentInfo> contentTypes = plugin.getContentInfos();
Object contentType = CollectionUtils.find( contentTypes, new Predicate() {
public boolean evaluate( Object object ) {
IContentInfo type = (IContentInfo) object;
return type.getTitle().equals( "Good Test Type" );
}
} );
assertNotNull( "\"Good Test Type\" should have been loaded", contentType );
assertNotNull( "\"Good Test Type\" extension definition is incorrect", ( (IContentInfo) contentType )
.getExtension().equals( "good-content-type" ) );
IContentInfo contentInfo = (IContentInfo) contentType;
IPluginOperation operation = contentInfo.getOperations().listIterator().next();
assertEquals( "Missing perspective", "custom-perspective", operation.getPerspective() );
assertEquals( "\"Test Type Missing type\" should not have been loaded", 0, CollectionUtils.countMatches(
contentTypes, new Predicate() {
public boolean evaluate( Object object ) {
IContentInfo type = (IContentInfo) object;
return type.getTitle().equals( "Test Type Missing type" );
}
} ) );
assertEquals( "\"test-type-missing-title\" should not have been loaded", 0, CollectionUtils.countMatches(
contentTypes, new Predicate() {
public boolean evaluate( Object object ) {
IContentInfo type = (IContentInfo) object;
return type.getExtension().equals( "test-type-missing-title" );
}
} ) );
}