@Test
  public void testGaelicLanguageIsSetForSubtitlesOnAlbaChannel() {
    Film film = createAlbaNitroFilm();
    ExtendedOnDemandProgramType onDemand = onDemandFor(film);

    InstanceDescriptionType instanceDesc = onDemand.getInstanceDescription();
    CaptionLanguageType captionLanguage =
        Iterables.getOnlyElement(instanceDesc.getCaptionLanguage());

    assertTrue(captionLanguage.isClosed());
    assertEquals(captionLanguage.getValue(), "gla");
  }
  @Test
  public void testSubtitledFlag() {
    CaptionLanguageType captionLanguage =
        Iterables.getOnlyElement(
            onDemandFor(createNitroFilm(true)).getInstanceDescription().getCaptionLanguage());

    assertTrue(captionLanguage.isClosed());
    assertEquals("en", captionLanguage.getValue());

    assertTrue(
        onDemandFor(createNitroFilm(false))
            .getInstanceDescription()
            .getCaptionLanguage()
            .isEmpty());
  }
  @Test
  public void testNonPublisherSpecificFields() {
    ItemOnDemandHierarchy onDemandHierarchy = hierarchyFrom(createNitroFilm(true));

    ExtendedOnDemandProgramType onDemand =
        (ExtendedOnDemandProgramType) generator.generate(onDemandHierarchy, ON_DEMAND_IMI);

    assertEquals("P0DT1H30M0.000S", onDemand.getPublishedDuration().toString());
    assertEquals("2012-07-03T00:00:00Z", onDemand.getStartOfAvailability().toString());
    assertEquals("2013-07-17T00:00:00Z", onDemand.getEndOfAvailability().toString());
    assertTrue(onDemand.getFree().isValue());

    InstanceDescriptionType instanceDesc = onDemand.getInstanceDescription();

    CaptionLanguageType captionLanguage =
        Iterables.getOnlyElement(instanceDesc.getCaptionLanguage());

    assertTrue(captionLanguage.isClosed());
    assertEquals(captionLanguage.getValue(), "en");

    List<SignLanguageType> signLanguages = instanceDesc.getSignLanguage();
    SignLanguageType signLanguageType = Iterables.getOnlyElement(signLanguages);
    assertEquals("bfi", signLanguageType.getValue());

    AVAttributesType avAttributes = instanceDesc.getAVAttributes();
    AudioAttributesType audioAttrs = Iterables.getOnlyElement(avAttributes.getAudioAttributes());

    assertEquals("urn:mpeg:mpeg7:cs:AudioPresentationCS:2001:3", audioAttrs.getMixType().getHref());

    VideoAttributesType videoAttrs = avAttributes.getVideoAttributes();

    assertEquals(Integer.valueOf(1280), videoAttrs.getHorizontalSize());
    assertEquals(Integer.valueOf(720), videoAttrs.getVerticalSize());
    assertEquals("16:9", Iterables.getOnlyElement(videoAttrs.getAspectRatio()).getValue());

    assertEquals(BigInteger.valueOf(VIDEO_BITRATE), avAttributes.getBitRate().getValue());
    assertTrue(avAttributes.getBitRate().isVariable());

    UniqueIDType otherId = Iterables.getOnlyElement(instanceDesc.getOtherIdentifier());
    assertEquals("b020tm1g", otherId.getValue());
    assertEquals("epid.bbc.co.uk", otherId.getAuthority());
  }