source = new StreamSource(new ByteArrayInputStream(DATA),MT_WITH_PARAM,FILE_NAME,HEADERS);
assertEquals(MT_WITH_PARAM, source.getMediaType());
}
@Test
public void checkMediaTypeForByteArraySource() throws IOException {
ContentSource source = new ByteArraySource(DATA);
assertEquals(DEFAULT_MT, source.getMediaType());
source = new ByteArraySource(DATA,null);
assertEquals(DEFAULT_MT, source.getMediaType());
source = new ByteArraySource(DATA,null,FILE_NAME,HEADERS);
assertEquals(DEFAULT_MT, source.getMediaType());
source = new ByteArraySource(DATA,MT);
assertEquals(MT, source.getMediaType());
source = new ByteArraySource(DATA,MT,FILE_NAME,HEADERS);
assertEquals(MT, source.getMediaType());
//Parameters MUST BE preserved!
source = new ByteArraySource(DATA,MT_WITH_PARAM);
assertEquals(MT_WITH_PARAM, source.getMediaType());
source = new ByteArraySource(DATA,MT_WITH_PARAM,FILE_NAME);
assertEquals(MT_WITH_PARAM, source.getMediaType());
source = new ByteArraySource(DATA,MT_WITH_PARAM,FILE_NAME,HEADERS);
assertEquals(MT_WITH_PARAM, source.getMediaType());
}