@Test public void variantCannotBeNull() throws Exception { try { Variants.contentType(null); fail("Should not accept null variants"); } catch (NullPointerException e) { assertThat(e.getMessage(),equalTo("Variant cannot be null")); } }
public static MediaType contentType(Variant variant) { requireNonNull(variant, "Variant cannot be null"); MediaType result=null; final MediaType type=variant.type(); if(type!=null) { result=assemble(type,charset(variant.charset())); } return result; }
Variants { public static MediaType contentType(Variant variant) { requireNonNull(variant, "Variant cannot be null"); MediaType result=null; final MediaType type=variant.type(); if(type!=null) { result=assemble(type,charset(variant.charset())); } return result; } }
Variants { public static MediaType contentType(Variant variant) { requireNonNull(variant, "Variant cannot be null"); MediaType result=null; final MediaType type=variant.type(); if(type!=null) { result=assemble(type,charset(variant.charset())); } return result; } private  Variants(); }
Variants { public static MediaType contentType(Variant variant) { requireNonNull(variant, "Variant cannot be null"); MediaType result=null; final MediaType type=variant.type(); if(type!=null) { result=assemble(type,charset(variant.charset())); } return result; } private  Variants(); static boolean equals(final Variant v1, final Variant v2); static MediaType contentType(Variant variant); static VariantBuilder builder(); static VariantBuilder from(Variant variant); }
Variants { public static MediaType contentType(Variant variant) { requireNonNull(variant, "Variant cannot be null"); MediaType result=null; final MediaType type=variant.type(); if(type!=null) { result=assemble(type,charset(variant.charset())); } return result; } private  Variants(); static boolean equals(final Variant v1, final Variant v2); static MediaType contentType(Variant variant); static VariantBuilder builder(); static VariantBuilder from(Variant variant);  }