Search in sources :

Example 1 with Predicate

use of org.opencastproject.util.data.Predicate in project opencast by opencast.

the class StaticMetadataServiceDublinCoreImplTest method testExtractMetadata.

@Test
public void testExtractMetadata() throws Exception {
    MediaPackage mp = newMediaPackage("/manifest-simple.xml");
    StaticMetadataServiceDublinCoreImpl ms = newStaticMetadataService();
    StaticMetadata md = ms.getMetadata(mp);
    assertEquals("Land and Vegetation: Key players on the Climate Scene", find(md.getTitles(), new Predicate<MetadataValue<String>>() {

        @Override
        public Boolean apply(MetadataValue<String> v) {
            return v.getLanguage().equals(MetadataValues.LANGUAGE_UNDEFINED);
        }
    }).map(new Function<MetadataValue<String>, String>() {

        @Override
        public String apply(MetadataValue<String> v) {
            return v.getValue();
        }
    }).getOrElse(""));
    assertEquals(createDate(2007, 12, 5, 0, 0, 0), md.getCreated().get());
}
Also used : MetadataValue(org.opencastproject.metadata.api.MetadataValue) MediaPackage(org.opencastproject.mediapackage.MediaPackage) StaticMetadata(org.opencastproject.metadata.api.StaticMetadata) Predicate(org.opencastproject.util.data.Predicate) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 MediaPackage (org.opencastproject.mediapackage.MediaPackage)1 MetadataValue (org.opencastproject.metadata.api.MetadataValue)1 StaticMetadata (org.opencastproject.metadata.api.StaticMetadata)1 Predicate (org.opencastproject.util.data.Predicate)1