try {
Metadata metadata = new Metadata();
metadata.set(Metadata.RESOURCE_NAME_KEY, tp.resourceStatedName);
metadata.set(Metadata.CONTENT_TYPE, tp.statedType);
StringWriter writer = new StringWriter();
ContentHandler handler = new WriteOutContentHandler(writer);
new AutoDetectParser().parse(input, handler, metadata);
assertEquals("Bad content type: " + tp,
tp.realType, metadata.get(Metadata.CONTENT_TYPE));