Variant variant5 = new Variant(MediaType.APPLICATION_JSON_TYPE, Locale.ENGLISH, "UTF-8");
Variant variant6 = new Variant(MediaType.APPLICATION_JSON_TYPE, Locale.ENGLISH, "UTF-16");
Variant variant7 = new Variant(MediaType.APPLICATION_JSON_TYPE, Locale.CHINESE, "UTF-8");
Variant variant8 = new Variant(MediaType.APPLICATION_JSON_TYPE, Locale.CHINESE, "UTF-16");
VariantListBuilder builder = new VariantListBuilderImpl();
List<Variant> list = null;
list =
builder.mediaTypes(MediaType.APPLICATION_ATOM_XML_TYPE).languages(Locale.ENGLISH)
.encodings("UTF-8").add().build();
assertList(new Variant[] {variant1}, list);
list =
builder.mediaTypes(MediaType.APPLICATION_ATOM_XML_TYPE).languages(Locale.ENGLISH)
.encodings("UTF-16").add().build();
assertList(new Variant[] {variant2}, list);
list =
builder.mediaTypes(MediaType.APPLICATION_ATOM_XML_TYPE).languages(Locale.ENGLISH)
.encodings("UTF-8", "UTF-16").add().build();
assertList(new Variant[] {variant1, variant2}, list);
list =
builder.mediaTypes(MediaType.APPLICATION_ATOM_XML_TYPE).languages(Locale.ENGLISH,
Locale.CHINESE)
.encodings("UTF-8", "UTF-16").add().build();
assertList(new Variant[] {variant1, variant2, variant3, variant4}, list);
list =
builder
.mediaTypes(MediaType.APPLICATION_ATOM_XML_TYPE, MediaType.APPLICATION_JSON_TYPE)
.languages(Locale.ENGLISH, Locale.CHINESE).encodings("UTF-8", "UTF-16").add()
.build();
assertList(new Variant[] {variant1, variant2, variant3, variant4, variant5, variant6,
variant7, variant8}, list);