@Test public void variantCannotBeNull() throws Exception { try { ImmutableAlternative.create(0.0D,null); fail("Should not accept null variants"); } catch (NullPointerException e) { assertThat(e.getMessage(),equalTo("Variant cannot be null")); } }
static ImmutableAlternative create(double quality, ImmutableVariant variant) { requireNonNull(variant,"Variant cannot be null"); requireNonNull(quality,"Quality cannot be null"); checkQuality(quality, "Quality"); return new ImmutableAlternative(quality,variant); }
ImmutableAlternative implements Alternative { static ImmutableAlternative create(double quality, ImmutableVariant variant) { requireNonNull(variant,"Variant cannot be null"); requireNonNull(quality,"Quality cannot be null"); checkQuality(quality, "Quality"); return new ImmutableAlternative(quality,variant); } }
ImmutableAlternative implements Alternative { static ImmutableAlternative create(double quality, ImmutableVariant variant) { requireNonNull(variant,"Variant cannot be null"); requireNonNull(quality,"Quality cannot be null"); checkQuality(quality, "Quality"); return new ImmutableAlternative(quality,variant); } private  ImmutableAlternative(final double quality, final ImmutableVariant variant); }
ImmutableAlternative implements Alternative { static ImmutableAlternative create(double quality, ImmutableVariant variant) { requireNonNull(variant,"Variant cannot be null"); requireNonNull(quality,"Quality cannot be null"); checkQuality(quality, "Quality"); return new ImmutableAlternative(quality,variant); } private  ImmutableAlternative(final double quality, final ImmutableVariant variant); @Override double quality(); @Override MediaType type(); @Override CharacterEncoding charset(); @Override Language language(); @Override String toString(); }
ImmutableAlternative implements Alternative { static ImmutableAlternative create(double quality, ImmutableVariant variant) { requireNonNull(variant,"Variant cannot be null"); requireNonNull(quality,"Quality cannot be null"); checkQuality(quality, "Quality"); return new ImmutableAlternative(quality,variant); } private  ImmutableAlternative(final double quality, final ImmutableVariant variant); @Override double quality(); @Override MediaType type(); @Override CharacterEncoding charset(); @Override Language language(); @Override String toString();  }