### Question:
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();  }### Answer:
@Test public void qualityCannotBeInvalid(@Mocked final ImmutableVariant variant) throws Exception { try { ImmutableAlternative.create(-1.0D,variant); fail("Should not accept invalid quality"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(),equalTo("Quality cannot be negative (-1.0)")); } }
@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")); } }