### Question:
ImmutableMediaType implements MediaType { static ImmutableMediaType copyOf(final MediaType other) { ImmutableMediaType result=null; if(other instanceof ImmutableMediaType) { result=(ImmutableMediaType)other; } else if(other!=null) { final String header = other.toHeader(); try { result=fromString(header,MediaRangeSyntax.RFC6838); } catch (InvalidMediaTypeException e) { result=fromString(header,MediaRangeSyntax.RFC7230); } } return result; } ImmutableMediaType(final MediaRangeSyntax syntax, final String type, final String subtype, String suffix, final Map<String, String> parameters); @Override String type(); @Override String subType(); @Override Charset charset(); @Override String suffix(); @Override Map<String,String> parameters(); @Override boolean isWildcard(); @Override String toHeader(); @Override int hashCode(); @Override boolean equals(final Object other); @Override String toString();  }### Answer:
@Test public void doesNotCloneNull() throws Exception { ImmutableMediaType original = null; ImmutableMediaType copy = ImmutableMediaType.copyOf(original); assertThat(copy,sameInstance(original)); }
@Test public void copyDoesNotCloneImmutableInstances() throws Exception { ImmutableMediaType original = defaultMediaType().build(); ImmutableMediaType copy = ImmutableMediaType.copyOf(original); assertThat(copy,sameInstance(original)); }