private void assertEncodingDetection(String encoding, String input, String expectedContent)
throws Exception {
DocumentSource fileDocumentSource = getDocumentSourceFromResource(input);
Any23 any23;
RepositoryConnection conn;
RepositoryWriter repositoryWriter;
any23 = new Any23();
Sail store = new MemoryStore();
store.initialize();
conn = new SailRepository(store).getConnection();
repositoryWriter = new RepositoryWriter(conn);
Assert.assertTrue( any23.extract(fileDocumentSource, repositoryWriter, encoding).hasMatchingExtractors() );
RepositoryResult<Statement> statements = conn.getStatements(null, vDCTERMS.title, null, false);
try {
while (statements.hasNext()) {
Statement statement = statements.next();
printStatement(statement);
org.junit.Assert.assertTrue(statement.getObject().stringValue().contains(expectedContent));
}
} finally {
statements.close();
}
fileDocumentSource = null;
any23 = null;
conn.close();
repositoryWriter.close();
}