@Override
    public void emit(String emitKey, List<Metadata> metadataList, ParseContext parseContext)
            throws IOException, TikaEmitterException {
        if (metadataList == null || metadataList.size() < 1) {
            return;
        }
        List<EmitData> emitDataList = new ArrayList<>();
        emitDataList.add(new EmitData(new EmitKey("", emitKey), metadataList));
        emit(emitDataList);
    }
@Test
    public void testVarcharTruncation(@TempDir Path tmpDir) throws Exception {
        Files.createDirectories(tmpDir.resolve("db"));
        Path dbDir = tmpDir.resolve("db/h2");
        Path config = tmpDir.resolve("tika-config.xml");
        String connectionString = "jdbc:h2:file:" + dbDir.toAbsolutePath();

        writeConfig("/configs/tika-config-jdbc-emitter-trunc.xml",
                connectionString, config);

        EmitterManager emitterManager = EmitterManager.load(config);
        Emitter emitter = emitterManager.getEmitter();
        List<String[]> data = new ArrayList<>();
        data.add(new String[]{"k1", "abcd"});
        data.add(new String[]{"k1", "abcdefghijklmnopqrs"});
        data.add(new String[]{"k1", "abcdefghijk"});
        int id = 0;
        for (String[] d : data) {
            emitter.emit("id" + id++, Collections.singletonList(m(d)), new ParseContext());
        }

        int rows = 0;
        try (Connection connection = DriverManager.getConnection(connectionString)) {
            try (Statement st = connection.createStatement()) {
                try (ResultSet rs = st.executeQuery("select * from test")) {
                    while (rs.next()) {
                        String s = rs.getString(2);
                        assertTrue(s.length() < 13);
                        assertFalse(s.contains("m"));
                        rows++;
                    }
                }
            }
        }
        assertEquals(3, rows);
    }