This is an automated email from the ASF dual-hosted git repository.

tballison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika.git


The following commit(s) were added to refs/heads/main by this push:
     new 45ce81e1f3 TIKA-5052: Fix broken test (#3551)
45ce81e1f3 is described below

commit 45ce81e1f3b21c1522eee996b6d2fe1c4e860483
Author: Tim Allison <[email protected]>
AuthorDate: Thu Nov 5 15:37:10 2026 -0500

    TIKA-5052: Fix broken test (#3551)
---
 .../org/apache/tika/ml/junkdetect/tools/HashedTrainerTest.java    | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/tika-ml/tika-ml-junkdetect-tools/src/test/java/org/apache/tika/ml/junkdetect/tools/HashedTrainerTest.java
 
b/tika-ml/tika-ml-junkdetect-tools/src/test/java/org/apache/tika/ml/junkdetect/tools/HashedTrainerTest.java
index b097f404a2..384c67ff36 100644
--- 
a/tika-ml/tika-ml-junkdetect-tools/src/test/java/org/apache/tika/ml/junkdetect/tools/HashedTrainerTest.java
+++ 
b/tika-ml/tika-ml-junkdetect-tools/src/test/java/org/apache/tika/ml/junkdetect/tools/HashedTrainerTest.java
@@ -207,7 +207,13 @@ public class HashedTrainerTest {
         ChainProbe chain = new ChainProbe();
         assertTrue(chain.describe().contains("HtmlEncodingDetector"), 
chain.describe());
         assertTrue(chain.describe().contains("MojibusterEncodingDetector"), 
chain.describe());
-        List<HashedFeatures.Vec> pairs = PairSources.goldChainPairs(gold, 
chain, 16, 3, 6000);
+        // the chain may get every fixture page right; a lying meta guarantees 
a wrong candidate
+        Files.write(dir.resolve("gold/docs/liar.html"), 
HashedTrainingFixture.page(HashedTrainingFixture.RU,
+                new Random(5052), 
"windows-1252").getBytes(Charset.forName("windows-1251")));
+        Path liar = dir.resolve("gold/liar.tsv");
+        Files.write(liar, List.of("path\tsplit\tlabel\thalf\ttext_quality",
+                "docs/liar.html\ttrain\twindows-1251\teven\tclean"));
+        List<HashedFeatures.Vec> pairs = 
PairSources.goldChainPairs(GoldPage.read(liar), chain, 16, 3, 6000);
         assertTrue(!pairs.isEmpty(), "no chain pairs");
         for (HashedFeatures.Vec v : pairs) {
             double l1 = 0;

Reply via email to