This is an automated email from the ASF dual-hosted git repository. mawiesne pushed a commit to branch OPENNLP-1672-Flip-misordered-assertEquals-arguments-in-several-tests in repository https://gitbox.apache.org/repos/asf/opennlp.git
commit 5df409266c48695b88ade582f1e8a32dbff947fa Author: Martin Wiesner <[email protected]> AuthorDate: Thu Dec 19 19:59:45 2024 +0100 OPENNLP-1672 Flip misordered assertEquals arguments in several tests --- .../opennlp/tools/chunker/ChunkSampleTest.java | 2 +- .../tools/chunker/ChunkerEvaluatorTest.java | 4 +- .../tokenizer/TokenizerTrainerToolTest.java | 4 +- .../opennlp/tools/doccat/DocumentSampleTest.java | 2 +- .../tools/formats/brat/BratDocumentTest.java | 20 ++-- .../masc/MascNamedEntitySampleStreamTest.java | 6 +- .../formats/masc/MascPOSSampleStreamTest.java | 6 +- .../formats/masc/MascSentenceSampleStreamTest.java | 6 +- .../formats/masc/MascTokenSampleStreamTest.java | 6 +- .../langdetect/LanguageDetectorEvaluatorTest.java | 2 +- .../tools/langdetect/LanguageSampleTest.java | 2 +- .../opennlp/tools/langdetect/LanguageTest.java | 2 +- .../opennlp/tools/lemmatizer/LemmaSampleTest.java | 2 +- .../ml/model/OnePassRealValueDataIndexerTest.java | 6 +- .../opennlp/tools/namefind/NameSampleTest.java | 2 +- .../opennlp/tools/parser/ParserEvaluatorTest.java | 6 +- .../java/opennlp/tools/postag/POSSampleTest.java | 10 +- .../sentdetect/SentenceDetectorEvaluatorTest.java | 2 +- .../tools/sentdetect/SentenceDetectorMEIT.java | 52 +++++----- .../tools/sentdetect/SentenceDetectorMETest.java | 60 +++++------ .../tools/sentdetect/SentenceSampleTest.java | 2 +- .../opennlp/tools/stemmer/SnowballStemmerTest.java | 112 ++++++++++----------- .../opennlp/tools/tokenize/TokenSampleTest.java | 2 +- .../opennlp/tools/util/TrainingParametersTest.java | 8 +- .../util/featuregen/GeneratorFactoryTest.java | 4 +- 25 files changed, 165 insertions(+), 165 deletions(-) diff --git a/opennlp-tools/src/test/java/opennlp/tools/chunker/ChunkSampleTest.java b/opennlp-tools/src/test/java/opennlp/tools/chunker/ChunkSampleTest.java index 434b7c70..4c9244ee 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/chunker/ChunkSampleTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/chunker/ChunkSampleTest.java @@ -296,7 +296,7 @@ public class ChunkSampleTest { Assertions.assertNotSame(createGoldSample(), createGoldSample()); Assertions.assertEquals(createGoldSample(), createGoldSample()); Assertions.assertNotEquals(createPredSample(), createGoldSample()); - Assertions.assertNotEquals(createPredSample(), new Object()); + Assertions.assertNotEquals(new Object(), createPredSample()); } } diff --git a/opennlp-tools/src/test/java/opennlp/tools/chunker/ChunkerEvaluatorTest.java b/opennlp-tools/src/test/java/opennlp/tools/chunker/ChunkerEvaluatorTest.java index aa6b8ef2..2ed90f12 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/chunker/ChunkerEvaluatorTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/chunker/ChunkerEvaluatorTest.java @@ -71,7 +71,7 @@ public class ChunkerEvaluatorTest { Assertions.assertEquals(0.8d, fm.getPrecisionScore(), DELTA); Assertions.assertEquals(0.875d, fm.getRecallScore(), DELTA); - Assertions.assertNotSame(stream.toString().length(), 0); + Assertions.assertNotSame(0, stream.toString().length()); } @Test @@ -101,7 +101,7 @@ public class ChunkerEvaluatorTest { Assertions.assertEquals(1d, fm.getPrecisionScore(), DELTA); Assertions.assertEquals(1d, fm.getRecallScore(), DELTA); - Assertions.assertEquals(stream.toString().length(), 0); + Assertions.assertEquals(0, stream.toString().length()); } } diff --git a/opennlp-tools/src/test/java/opennlp/tools/cmdline/tokenizer/TokenizerTrainerToolTest.java b/opennlp-tools/src/test/java/opennlp/tools/cmdline/tokenizer/TokenizerTrainerToolTest.java index 6bfdb0be..65993fb0 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/cmdline/tokenizer/TokenizerTrainerToolTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/cmdline/tokenizer/TokenizerTrainerToolTest.java @@ -57,8 +57,8 @@ public class TokenizerTrainerToolTest extends AbstractTempDirTest { @Test public void testGetShortDescription() { tokenizerTrainerTool = new TokenizerTrainerTool(); - Assertions.assertEquals(tokenizerTrainerTool.getShortDescription() , - "Trainer for the learnable tokenizer"); + Assertions.assertEquals("Trainer for the learnable tokenizer", + tokenizerTrainerTool.getShortDescription()); } @Test diff --git a/opennlp-tools/src/test/java/opennlp/tools/doccat/DocumentSampleTest.java b/opennlp-tools/src/test/java/opennlp/tools/doccat/DocumentSampleTest.java index 8989a095..8bc3bb0a 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/doccat/DocumentSampleTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/doccat/DocumentSampleTest.java @@ -35,7 +35,7 @@ public class DocumentSampleTest { Assertions.assertNotSame(createGoldSample(), createGoldSample()); Assertions.assertEquals(createGoldSample(), createGoldSample()); Assertions.assertNotEquals(createPredSample(), createGoldSample()); - Assertions.assertNotEquals(createPredSample(), new Object()); + Assertions.assertNotEquals(new Object(), createPredSample()); } @Test diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/brat/BratDocumentTest.java b/opennlp-tools/src/test/java/opennlp/tools/formats/brat/BratDocumentTest.java index bfac3dd3..374059a8 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/formats/brat/BratDocumentTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/formats/brat/BratDocumentTest.java @@ -75,17 +75,17 @@ public class BratDocumentTest extends AbstractBratTest { BratDocument doc = BratDocument.parseDocument(config, "opennlp-1193", txtIn, annIn); SpanAnnotation t1 = (SpanAnnotation) doc.getAnnotation("T1"); - Assertions.assertEquals(t1.getSpans()[0].getStart(), 0); - Assertions.assertEquals(t1.getSpans()[0].getEnd(), 7); - Assertions.assertEquals(t1.getSpans()[1].getStart(), 8); - Assertions.assertEquals(t1.getSpans()[1].getEnd(), 15); - Assertions.assertEquals(t1.getSpans()[2].getStart(), 17); - Assertions.assertEquals(t1.getSpans()[2].getEnd(), 24); + Assertions.assertEquals(0, t1.getSpans()[0].getStart()); + Assertions.assertEquals(7, t1.getSpans()[0].getEnd()); + Assertions.assertEquals(8, t1.getSpans()[1].getStart()); + Assertions.assertEquals(15, t1.getSpans()[1].getEnd()); + Assertions.assertEquals(17, t1.getSpans()[2].getStart()); + Assertions.assertEquals(24, t1.getSpans()[2].getEnd()); SpanAnnotation t2 = (SpanAnnotation) doc.getAnnotation("T2"); - Assertions.assertEquals(t2.getSpans()[0].getStart(), 26); - Assertions.assertEquals(t2.getSpans()[0].getEnd(), 33); - Assertions.assertEquals(t2.getSpans()[1].getStart(), 40); - Assertions.assertEquals(t2.getSpans()[1].getEnd(), 47); + Assertions.assertEquals(26, t2.getSpans()[0].getStart()); + Assertions.assertEquals(33, t2.getSpans()[0].getEnd()); + Assertions.assertEquals(40, t2.getSpans()[1].getStart()); + Assertions.assertEquals(47, t2.getSpans()[1].getEnd()); } } diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamTest.java b/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamTest.java index 7b398986..543bebeb 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamTest.java @@ -79,9 +79,9 @@ public class MascNamedEntitySampleStreamTest extends AbstractMascSampleStreamTes stream.close(); NameSample s = stream.read(); } catch (IOException e) { - Assertions.assertEquals(e.getMessage(), - "You are reading an empty document stream. " + - "Did you close it?"); + Assertions.assertEquals("You are reading an empty document stream. " + + "Did you close it?", + e.getMessage()); } } diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascPOSSampleStreamTest.java b/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascPOSSampleStreamTest.java index 73f31f51..7a6d8456 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascPOSSampleStreamTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascPOSSampleStreamTest.java @@ -73,9 +73,9 @@ public class MascPOSSampleStreamTest extends AbstractMascSampleStreamTest { stream.close(); POSSample s = stream.read(); } catch (IOException e) { - Assertions.assertEquals(e.getMessage(), - "You are reading an empty document stream. " + - "Did you close it?"); + Assertions.assertEquals("You are reading an empty document stream. " + + "Did you close it?", + e.getMessage()); } } diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascSentenceSampleStreamTest.java b/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascSentenceSampleStreamTest.java index 6cd2bccc..24e7d569 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascSentenceSampleStreamTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascSentenceSampleStreamTest.java @@ -84,9 +84,9 @@ public class MascSentenceSampleStreamTest extends AbstractMascSampleStreamTest { stream.close(); stream.read(); } catch (IOException e) { - Assertions.assertEquals(e.getMessage(), - "You are reading an empty document stream. " + - "Did you close it?"); + Assertions.assertEquals("You are reading an empty document stream. " + + "Did you close it?", + e.getMessage()); } } diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascTokenSampleStreamTest.java b/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascTokenSampleStreamTest.java index e379f390..7ed972c2 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascTokenSampleStreamTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascTokenSampleStreamTest.java @@ -86,9 +86,9 @@ public class MascTokenSampleStreamTest extends AbstractMascSampleStreamTest { stream.close(); TokenSample s = stream.read(); } catch (IOException e) { - Assertions.assertEquals(e.getMessage(), - "You are reading an empty document stream. " + - "Did you close it?"); + Assertions.assertEquals("You are reading an empty document stream. " + + "Did you close it?", + e.getMessage()); } } diff --git a/opennlp-tools/src/test/java/opennlp/tools/langdetect/LanguageDetectorEvaluatorTest.java b/opennlp-tools/src/test/java/opennlp/tools/langdetect/LanguageDetectorEvaluatorTest.java index 0f520323..69a8f523 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/langdetect/LanguageDetectorEvaluatorTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/langdetect/LanguageDetectorEvaluatorTest.java @@ -68,7 +68,7 @@ public class LanguageDetectorEvaluatorTest { Assertions.assertEquals(2, incorrectCount.get()); Assertions.assertEquals(3, evaluator.getDocumentCount()); - Assertions.assertEquals(evaluator.getAccuracy(), 0.01, 0.33); + Assertions.assertEquals(0.01, evaluator.getAccuracy(), 0.33); String report = outputStream.toString(StandardCharsets.UTF_8); diff --git a/opennlp-tools/src/test/java/opennlp/tools/langdetect/LanguageSampleTest.java b/opennlp-tools/src/test/java/opennlp/tools/langdetect/LanguageSampleTest.java index b58a0bfc..4ebcdac7 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/langdetect/LanguageSampleTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/langdetect/LanguageSampleTest.java @@ -125,6 +125,6 @@ public class LanguageSampleTest { Assertions.assertNotEquals(sampleA, sampleB); Assertions.assertNotEquals(sampleA, sampleC); Assertions.assertNotEquals(sampleB, sampleC); - Assertions.assertNotEquals(sampleA.context(), "something else"); + Assertions.assertNotEquals("something else", sampleA.context()); } } diff --git a/opennlp-tools/src/test/java/opennlp/tools/langdetect/LanguageTest.java b/opennlp-tools/src/test/java/opennlp/tools/langdetect/LanguageTest.java index 6266ba1c..4d55012f 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/langdetect/LanguageTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/langdetect/LanguageTest.java @@ -95,6 +95,6 @@ public class LanguageTest { Assertions.assertEquals(langA6, langA5); - Assertions.assertNotEquals(langA.getLang(), "something else"); + Assertions.assertNotEquals("something else", langA.getLang()); } } diff --git a/opennlp-tools/src/test/java/opennlp/tools/lemmatizer/LemmaSampleTest.java b/opennlp-tools/src/test/java/opennlp/tools/lemmatizer/LemmaSampleTest.java index 29413166..6bc67035 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/lemmatizer/LemmaSampleTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/lemmatizer/LemmaSampleTest.java @@ -114,7 +114,7 @@ public class LemmaSampleTest { Assertions.assertNotSame(createGoldSample(), createGoldSample()); Assertions.assertEquals(createGoldSample(), createGoldSample()); Assertions.assertNotEquals(createPredSample(), createGoldSample()); - Assertions.assertNotEquals(createPredSample(), new Object()); + Assertions.assertNotEquals(new Object(), createPredSample()); } public static LemmaSample createGoldSample() { diff --git a/opennlp-tools/src/test/java/opennlp/tools/ml/model/OnePassRealValueDataIndexerTest.java b/opennlp-tools/src/test/java/opennlp/tools/ml/model/OnePassRealValueDataIndexerTest.java index 9f7604d6..419d7918 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/ml/model/OnePassRealValueDataIndexerTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/ml/model/OnePassRealValueDataIndexerTest.java @@ -100,11 +100,11 @@ public class OnePassRealValueDataIndexerTest { Assertions.assertEquals(3, indexer.getValues().length); final float delta = 0.001F; Assertions.assertArrayEquals( - indexer.getValues()[0], new float[] {0.1F, 0.2F, 0.1F, 0.1F, 0.1F, 0.1F, 0.1F}, delta); + new float[] {0.1F, 0.2F, 0.1F, 0.1F, 0.1F, 0.1F, 0.1F}, indexer.getValues()[0], delta); Assertions.assertArrayEquals( - indexer.getValues()[1], new float[] {0.1F, 0.2F, 0.1F, 0.1F, 0.1F, 0.1F, 0.1F, 0.1F, 0.1F}, delta); + new float[] {0.1F, 0.2F, 0.1F, 0.1F, 0.1F, 0.1F, 0.1F, 0.1F, 0.1F}, indexer.getValues()[1], delta); Assertions.assertArrayEquals( - indexer.getValues()[2], new float[] {0.1F, 0.2F, 0.1F, 0.1F, 0.1F, 0.1F, 0.1F, 0.1F, 0.1F}, delta); + new float[] {0.1F, 0.2F, 0.1F, 0.1F, 0.1F, 0.1F, 0.1F, 0.1F, 0.1F}, indexer.getValues()[2], delta); Assertions.assertEquals(5, indexer.getNumEvents()); Assertions.assertArrayEquals(new int[] {0, 1, 2}, indexer.getOutcomeList()); Assertions.assertArrayEquals(new int[] {3, 1, 1}, indexer.getNumTimesEventsSeen()); diff --git a/opennlp-tools/src/test/java/opennlp/tools/namefind/NameSampleTest.java b/opennlp-tools/src/test/java/opennlp/tools/namefind/NameSampleTest.java index e9eeff21..42879f3b 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/namefind/NameSampleTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/namefind/NameSampleTest.java @@ -291,7 +291,7 @@ public class NameSampleTest { Assertions.assertNotSame(createGoldSample(), createGoldSample()); Assertions.assertEquals(createGoldSample(), createGoldSample()); Assertions.assertNotEquals(createGoldSample(), createPredSample()); - Assertions.assertNotEquals(createPredSample(), new Object()); + Assertions.assertNotEquals(new Object(), createPredSample()); } public static NameSample createGoldSample() { diff --git a/opennlp-tools/src/test/java/opennlp/tools/parser/ParserEvaluatorTest.java b/opennlp-tools/src/test/java/opennlp/tools/parser/ParserEvaluatorTest.java index 11918a8c..d6d5adf7 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/parser/ParserEvaluatorTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/parser/ParserEvaluatorTest.java @@ -76,9 +76,9 @@ public class ParserEvaluatorTest { Assertions.assertNotNull(measure); // Expected output: Precision: 0.42857142857142855, Recall: 0.375, F-Measure: 0.39999999999999997 - Assertions.assertEquals(measure.getPrecisionScore(), 0.42857142857142855d, 0d); - Assertions.assertEquals(measure.getRecallScore(), 0.375d, 0d); - Assertions.assertEquals(measure.getFMeasure(), 0.39999999999999997d, 0d); + Assertions.assertEquals(0.42857142857142855d, measure.getPrecisionScore(), 0d); + Assertions.assertEquals(0.375d, measure.getRecallScore(), 0d); + Assertions.assertEquals(0.39999999999999997d, measure.getFMeasure(), 0d); } } diff --git a/opennlp-tools/src/test/java/opennlp/tools/postag/POSSampleTest.java b/opennlp-tools/src/test/java/opennlp/tools/postag/POSSampleTest.java index 1d6fc3f1..1c39e66f 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/postag/POSSampleTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/postag/POSSampleTest.java @@ -41,7 +41,7 @@ public class POSSampleTest { Assertions.assertNotSame(createGoldSample(), createGoldSample()); Assertions.assertEquals(createGoldSample(), createGoldSample()); Assertions.assertNotEquals(createPredSample(), createGoldSample()); - Assertions.assertNotEquals(createPredSample(), new Object()); + Assertions.assertNotEquals(new Object(), createPredSample()); } public static POSSample createGoldSample() throws InvalidFormatException { @@ -102,8 +102,8 @@ public class POSSampleTest { POSSample sample = POSSample.parse(sentence); - Assertions.assertEquals(sample.getSentence().length, 0); - Assertions.assertEquals(sample.getTags().length, 0); + Assertions.assertEquals(0, sample.getSentence().length); + Assertions.assertEquals(0, sample.getTags().length); } /** @@ -113,7 +113,7 @@ public class POSSampleTest { void testParseEmtpyToken() throws InvalidFormatException { String sentence = "the_DT _NNS"; POSSample sample = POSSample.parse(sentence); - Assertions.assertEquals(sample.getSentence()[1], ""); + Assertions.assertEquals("", sample.getSentence()[1]); } /** @@ -123,7 +123,7 @@ public class POSSampleTest { void testParseEmtpyTag() throws InvalidFormatException { String sentence = "the_DT stories_"; POSSample sample = POSSample.parse(sentence); - Assertions.assertEquals(sample.getTags()[1], ""); + Assertions.assertEquals("", sample.getTags()[1]); } /** diff --git a/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceDetectorEvaluatorTest.java b/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceDetectorEvaluatorTest.java index df3a97b7..f7c953ae 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceDetectorEvaluatorTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceDetectorEvaluatorTest.java @@ -52,7 +52,7 @@ public class SentenceDetectorEvaluatorTest { eval.evaluateSample(SentenceSampleTest.createPredSample()); - Assertions.assertEquals(eval.getFMeasure().getFMeasure(), -1.0, .1d); + Assertions.assertEquals(-1.0, eval.getFMeasure().getFMeasure(), .1d); Assertions.assertNotSame(0, stream.toString().length()); } diff --git a/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceDetectorMEIT.java b/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceDetectorMEIT.java index a40a56c1..e722fdc3 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceDetectorMEIT.java +++ b/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceDetectorMEIT.java @@ -34,50 +34,50 @@ public class SentenceDetectorMEIT { // Tests sentence detector with sentDetect method String sampleSentences1 = "This is a test. There are many tests, this is the second."; String[] sents = sentDetect.sentDetect(sampleSentences1); - Assertions.assertEquals(sents.length, 2); - Assertions.assertEquals(sents[0], "This is a test."); - Assertions.assertEquals(sents[1], "There are many tests, this is the second."); + Assertions.assertEquals(2, sents.length); + Assertions.assertEquals("This is a test.", sents[0]); + Assertions.assertEquals("There are many tests, this is the second.", sents[1]); double[] probs = sentDetect.getSentenceProbabilities(); - Assertions.assertEquals(probs.length, 2); + Assertions.assertEquals(2, probs.length); String sampleSentences2 = "This is a test. There are many tests, this is the second"; sents = sentDetect.sentDetect(sampleSentences2); - Assertions.assertEquals(sents.length, 2); + Assertions.assertEquals(2, sents.length); probs = sentDetect.getSentenceProbabilities(); - Assertions.assertEquals(probs.length, 2); - Assertions.assertEquals(sents[0], "This is a test."); - Assertions.assertEquals(sents[1], "There are many tests, this is the second"); + Assertions.assertEquals(2, probs.length); + Assertions.assertEquals("This is a test.", sents[0]); + Assertions.assertEquals("There are many tests, this is the second", sents[1]); String sampleSentences3 = "This is a \"test\". He said \"There are many tests, this is the second.\""; sents = sentDetect.sentDetect(sampleSentences3); - Assertions.assertEquals(sents.length, 2); + Assertions.assertEquals(2, sents.length); probs = sentDetect.getSentenceProbabilities(); - Assertions.assertEquals(probs.length, 2); - Assertions.assertEquals(sents[0], "This is a \"test\"."); - Assertions.assertEquals(sents[1], "He said \"There are many tests, this is the second.\""); + Assertions.assertEquals(2, probs.length); + Assertions.assertEquals("This is a \"test\".", sents[0]); + Assertions.assertEquals("He said \"There are many tests, this is the second.\"", sents[1]); String sampleSentences4 = "This is a \"test\". I said \"This is a test.\" Any questions?"; sents = sentDetect.sentDetect(sampleSentences4); - Assertions.assertEquals(sents.length, 3); + Assertions.assertEquals(3, sents.length); probs = sentDetect.getSentenceProbabilities(); - Assertions.assertEquals(probs.length, 3); - Assertions.assertEquals(sents[0], "This is a \"test\"."); - Assertions.assertEquals(sents[1], "I said \"This is a test.\""); - Assertions.assertEquals(sents[2], "Any questions?"); + Assertions.assertEquals(3, probs.length); + Assertions.assertEquals("This is a \"test\".", sents[0]); + Assertions.assertEquals("I said \"This is a test.\"", sents[1]); + Assertions.assertEquals("Any questions?", sents[2]); String sampleSentences5 = "This is a one sentence test space at the end. "; sents = sentDetect.sentDetect(sampleSentences5); Assertions.assertEquals(1, sentDetect.getSentenceProbabilities().length); - Assertions.assertEquals(sents[0], "This is a one sentence test space at the end."); + Assertions.assertEquals("This is a one sentence test space at the end.", sents[0]); String sampleSentences6 = "This is a one sentences test with tab at the end. "; sents = sentDetect.sentDetect(sampleSentences6); - Assertions.assertEquals(sents[0], "This is a one sentences test with tab at the end."); + Assertions.assertEquals("This is a one sentences test with tab at the end.", sents[0]); String sampleSentences7 = "This is a test. With spaces between the two sentences."; sents = sentDetect.sentDetect(sampleSentences7); - Assertions.assertEquals(sents[0], "This is a test."); - Assertions.assertEquals(sents[1], "With spaces between the two sentences."); + Assertions.assertEquals("This is a test.", sents[0]); + Assertions.assertEquals("With spaces between the two sentences.", sents[1]); String sampleSentences9 = ""; sents = sentDetect.sentDetect(sampleSentences9); @@ -89,23 +89,23 @@ public class SentenceDetectorMEIT { String sampleSentences11 = "This is test sentence without a dot at the end and spaces "; sents = sentDetect.sentDetect(sampleSentences11); - Assertions.assertEquals(sents[0], "This is test sentence without a dot at the end and spaces"); + Assertions.assertEquals("This is test sentence without a dot at the end and spaces", sents[0]); probs = sentDetect.getSentenceProbabilities(); Assertions.assertEquals(1, probs.length); String sampleSentence12 = " This is a test."; sents = sentDetect.sentDetect(sampleSentence12); - Assertions.assertEquals(sents[0], "This is a test."); + Assertions.assertEquals("This is a test.", sents[0]); String sampleSentence13 = " This is a test"; sents = sentDetect.sentDetect(sampleSentence13); - Assertions.assertEquals(sents[0], "This is a test"); + Assertions.assertEquals("This is a test", sents[0]); // Test that sentPosDetect also works Span[] pos = sentDetect.sentPosDetect(sampleSentences2); - Assertions.assertEquals(pos.length, 2); + Assertions.assertEquals(2, pos.length); probs = sentDetect.getSentenceProbabilities(); - Assertions.assertEquals(probs.length, 2); + Assertions.assertEquals(2, probs.length); Assertions.assertEquals(new Span(0, 15), pos[0]); Assertions.assertEquals(new Span(16, 56), pos[1]); diff --git a/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceDetectorMETest.java b/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceDetectorMETest.java index 849c55c8..d5646f32 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceDetectorMETest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceDetectorMETest.java @@ -57,50 +57,50 @@ public class SentenceDetectorMETest extends AbstractSentenceDetectorTest { // Tests sentence detector with sentDetect method String sampleSentences1 = "This is a test. There are many tests, this is the second."; String[] sents = sentDetect.sentDetect(sampleSentences1); - Assertions.assertEquals(sents.length, 2); - Assertions.assertEquals(sents[0], "This is a test."); - Assertions.assertEquals(sents[1], "There are many tests, this is the second."); + Assertions.assertEquals(2, sents.length); + Assertions.assertEquals("This is a test.", sents[0]); + Assertions.assertEquals("There are many tests, this is the second.", sents[1]); double[] probs = sentDetect.getSentenceProbabilities(); - Assertions.assertEquals(probs.length, 2); + Assertions.assertEquals(2, probs.length); String sampleSentences2 = "This is a test. There are many tests, this is the second"; sents = sentDetect.sentDetect(sampleSentences2); - Assertions.assertEquals(sents.length, 2); + Assertions.assertEquals(2, sents.length); probs = sentDetect.getSentenceProbabilities(); - Assertions.assertEquals(probs.length, 2); - Assertions.assertEquals(sents[0], "This is a test."); - Assertions.assertEquals(sents[1], "There are many tests, this is the second"); + Assertions.assertEquals(2, probs.length); + Assertions.assertEquals("This is a test.", sents[0]); + Assertions.assertEquals("There are many tests, this is the second", sents[1]); String sampleSentences3 = "This is a \"test\". He said \"There are many tests, this is the second.\""; sents = sentDetect.sentDetect(sampleSentences3); - Assertions.assertEquals(sents.length, 2); + Assertions.assertEquals(2, sents.length); probs = sentDetect.getSentenceProbabilities(); - Assertions.assertEquals(probs.length, 2); - Assertions.assertEquals(sents[0], "This is a \"test\"."); - Assertions.assertEquals(sents[1], "He said \"There are many tests, this is the second.\""); + Assertions.assertEquals(2, probs.length); + Assertions.assertEquals("This is a \"test\".", sents[0]); + Assertions.assertEquals("He said \"There are many tests, this is the second.\"", sents[1]); String sampleSentences4 = "This is a \"test\". I said \"This is a test.\" Any questions?"; sents = sentDetect.sentDetect(sampleSentences4); - Assertions.assertEquals(sents.length, 3); + Assertions.assertEquals(3, sents.length); probs = sentDetect.getSentenceProbabilities(); - Assertions.assertEquals(probs.length, 3); - Assertions.assertEquals(sents[0], "This is a \"test\"."); - Assertions.assertEquals(sents[1], "I said \"This is a test.\""); - Assertions.assertEquals(sents[2], "Any questions?"); + Assertions.assertEquals(3, probs.length); + Assertions.assertEquals("This is a \"test\".", sents[0]); + Assertions.assertEquals("I said \"This is a test.\"", sents[1]); + Assertions.assertEquals("Any questions?", sents[2]); String sampleSentences5 = "This is a one sentence test space at the end. "; sents = sentDetect.sentDetect(sampleSentences5); Assertions.assertEquals(1, sentDetect.getSentenceProbabilities().length); - Assertions.assertEquals(sents[0], "This is a one sentence test space at the end."); + Assertions.assertEquals("This is a one sentence test space at the end.", sents[0]); String sampleSentences6 = "This is a one sentences test with tab at the end. "; sents = sentDetect.sentDetect(sampleSentences6); - Assertions.assertEquals(sents[0], "This is a one sentences test with tab at the end."); + Assertions.assertEquals("This is a one sentences test with tab at the end.", sents[0]); String sampleSentences7 = "This is a test. With spaces between the two sentences."; sents = sentDetect.sentDetect(sampleSentences7); - Assertions.assertEquals(sents[0], "This is a test."); - Assertions.assertEquals(sents[1], "With spaces between the two sentences."); + Assertions.assertEquals("This is a test.", sents[0]); + Assertions.assertEquals("With spaces between the two sentences.", sents[1]); String sampleSentences9 = ""; sents = sentDetect.sentDetect(sampleSentences9); @@ -112,23 +112,23 @@ public class SentenceDetectorMETest extends AbstractSentenceDetectorTest { String sampleSentences11 = "This is test sentence without a dot at the end and spaces "; sents = sentDetect.sentDetect(sampleSentences11); - Assertions.assertEquals(sents[0], "This is test sentence without a dot at the end and spaces"); + Assertions.assertEquals("This is test sentence without a dot at the end and spaces", sents[0]); probs = sentDetect.getSentenceProbabilities(); Assertions.assertEquals(1, probs.length); String sampleSentence12 = " This is a test."; sents = sentDetect.sentDetect(sampleSentence12); - Assertions.assertEquals(sents[0], "This is a test."); + Assertions.assertEquals("This is a test.", sents[0]); String sampleSentence13 = " This is a test"; sents = sentDetect.sentDetect(sampleSentence13); - Assertions.assertEquals(sents[0], "This is a test"); + Assertions.assertEquals("This is a test", sents[0]); // Test that sentPosDetect also works Span[] pos = sentDetect.sentPosDetect(sampleSentences2); - Assertions.assertEquals(pos.length, 2); + Assertions.assertEquals(2, pos.length); probs = sentDetect.getSentenceProbabilities(); - Assertions.assertEquals(probs.length, 2); + Assertions.assertEquals(2, probs.length); Assertions.assertEquals(new Span(0, 15), pos[0]); Assertions.assertEquals(new Span(16, 56), pos[1]); @@ -145,11 +145,11 @@ public class SentenceDetectorMETest extends AbstractSentenceDetectorTest { String sampleSentences1 = "This is a test for Mr. Miller. " + "His wife, Ms. Susan Miller, is also part of this test."; String[] sents = sentDetect.sentDetect(sampleSentences1); - Assertions.assertEquals(sents.length, 2); - Assertions.assertEquals(sents[0], "This is a test for Mr. Miller."); - Assertions.assertEquals(sents[1], "His wife, Ms. Susan Miller, is also part of this test."); + Assertions.assertEquals(2, sents.length); + Assertions.assertEquals("This is a test for Mr. Miller.", sents[0]); + Assertions.assertEquals("His wife, Ms. Susan Miller, is also part of this test.", sents[1]); double[] probs = sentDetect.getSentenceProbabilities(); - Assertions.assertEquals(probs.length, 2); + Assertions.assertEquals(2, probs.length); } @Test diff --git a/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceSampleTest.java b/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceSampleTest.java index 3d4b7972..9c2b6a95 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceSampleTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceSampleTest.java @@ -83,7 +83,7 @@ public class SentenceSampleTest { Assertions.assertNotSame(createGoldSample(), createGoldSample()); Assertions.assertEquals(createGoldSample(), createGoldSample()); Assertions.assertNotEquals(createPredSample(), createGoldSample()); - Assertions.assertNotEquals(createPredSample(), new Object()); + Assertions.assertNotEquals(new Object(), createPredSample()); } public static SentenceSample createGoldSample() { diff --git a/opennlp-tools/src/test/java/opennlp/tools/stemmer/SnowballStemmerTest.java b/opennlp-tools/src/test/java/opennlp/tools/stemmer/SnowballStemmerTest.java index 03f7b2aa..3c9c5693 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/stemmer/SnowballStemmerTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/stemmer/SnowballStemmerTest.java @@ -28,44 +28,44 @@ public class SnowballStemmerTest { @Test void testArabic() { SnowballStemmer stemmer = new SnowballStemmer(ALGORITHM.ARABIC); - Assertions.assertEquals(stemmer.stem("أأباءاهم"), "اباء"); - Assertions.assertEquals(stemmer.stem("استفتياكما"), "استفتي"); - Assertions.assertEquals(stemmer.stem("استنتاجاتهما"), "استنتاجا"); + Assertions.assertEquals("اباء", stemmer.stem("أأباءاهم")); + Assertions.assertEquals("استفتي", stemmer.stem("استفتياكما")); + Assertions.assertEquals("استنتاجا", stemmer.stem("استنتاجاتهما")); } @Test void testDanish() { SnowballStemmer stemmer = new SnowballStemmer(ALGORITHM.DANISH); - Assertions.assertEquals(stemmer.stem("aabenbaringen"), "aabenbaring"); - Assertions.assertEquals(stemmer.stem("skuebrødsbordene"), "skuebrødsbord"); - Assertions.assertEquals(stemmer.stem("skrøbeligheder"), "skrøb"); + Assertions.assertEquals("aabenbaring", stemmer.stem("aabenbaringen")); + Assertions.assertEquals("skuebrødsbord", stemmer.stem("skuebrødsbordene")); + Assertions.assertEquals("skrøb", stemmer.stem("skrøbeligheder")); } @Test void testDutch() { SnowballStemmer stemmer = new SnowballStemmer(ALGORITHM.DUTCH); - Assertions.assertEquals(stemmer.stem("vliegtuigtransport"), "vliegtuigtransport"); - Assertions.assertEquals(stemmer.stem("sterlabcertificaat"), "sterlabcertificat"); - Assertions.assertEquals(stemmer.stem("vollegrondsgroenteteelt"), - "vollegrondsgroenteteelt"); + Assertions.assertEquals("vliegtuigtransport", stemmer.stem("vliegtuigtransport")); + Assertions.assertEquals("sterlabcertificat", stemmer.stem("sterlabcertificaat")); + Assertions.assertEquals("vollegrondsgroenteteelt", + stemmer.stem("vollegrondsgroenteteelt")); } @Test void testCatalan() { SnowballStemmer stemmer = new SnowballStemmer(ALGORITHM.CATALAN); - Assertions.assertEquals(stemmer.stem("importantíssimes"), "important"); - Assertions.assertEquals(stemmer.stem("besar"), "bes"); - Assertions.assertEquals(stemmer.stem("accidentalment"), "accidental"); + Assertions.assertEquals("important", stemmer.stem("importantíssimes")); + Assertions.assertEquals("bes", stemmer.stem("besar")); + Assertions.assertEquals("accidental", stemmer.stem("accidentalment")); } @Test void testEnglish() { SnowballStemmer stemmer = new SnowballStemmer(ALGORITHM.ENGLISH); - Assertions.assertEquals(stemmer.stem("accompanying"), "accompani"); - Assertions.assertEquals(stemmer.stem("malediction"), "maledict"); - Assertions.assertEquals(stemmer.stem("softeners"), "soften"); + Assertions.assertEquals("accompani", stemmer.stem("accompanying")); + Assertions.assertEquals("maledict", stemmer.stem("malediction")); + Assertions.assertEquals("soften", stemmer.stem("softeners")); } @@ -78,115 +78,115 @@ public class SnowballStemmerTest { @Test void testFinnish() { SnowballStemmer stemmer = new SnowballStemmer(ALGORITHM.FINNISH); - Assertions.assertEquals(stemmer.stem("esiintymispaikasta"), "esiintymispaik"); - Assertions.assertEquals(stemmer.stem("esiintyviätaiteilijaystäviään"), - "esiintyviätaiteilijaystäviä"); - Assertions.assertEquals(stemmer.stem("hellbergiä"), "hellberg"); + Assertions.assertEquals("esiintymispaik", stemmer.stem("esiintymispaikasta")); + Assertions.assertEquals("esiintyviätaiteilijaystäviä", + stemmer.stem("esiintyviätaiteilijaystäviään")); + Assertions.assertEquals("hellberg", stemmer.stem("hellbergiä")); } @Test void testFrench() { SnowballStemmer stemmer = new SnowballStemmer(ALGORITHM.FRENCH); - Assertions.assertEquals(stemmer.stem("accomplissaient"), "accompl"); - Assertions.assertEquals(stemmer.stem("examinateurs"), "examin"); - Assertions.assertEquals(stemmer.stem("prévoyant"), "prévoi"); + Assertions.assertEquals("accompl", stemmer.stem("accomplissaient")); + Assertions.assertEquals("examin", stemmer.stem("examinateurs")); + Assertions.assertEquals("prévoi", stemmer.stem("prévoyant")); } @Test void testGerman() { SnowballStemmer stemmer = new SnowballStemmer(ALGORITHM.GERMAN); - Assertions.assertEquals(stemmer.stem("buchbindergesellen"), "buchbindergesell"); - Assertions.assertEquals(stemmer.stem("mindere"), "mind"); - Assertions.assertEquals(stemmer.stem("mitverursacht"), "mitverursacht"); + Assertions.assertEquals("buchbindergesell", stemmer.stem("buchbindergesellen")); + Assertions.assertEquals("mind", stemmer.stem("mindere")); + Assertions.assertEquals("mitverursacht", stemmer.stem("mitverursacht")); } @Test void testGreek() { SnowballStemmer stemmer = new SnowballStemmer(ALGORITHM.GREEK); - Assertions.assertEquals(stemmer.stem("επιστροφή"), "επιστροφ"); - Assertions.assertEquals(stemmer.stem("Αμερικανών"), "αμερικαν"); - Assertions.assertEquals(stemmer.stem("στρατιωτών"), "στρατιωτ"); + Assertions.assertEquals("επιστροφ", stemmer.stem("επιστροφή")); + Assertions.assertEquals("αμερικαν", stemmer.stem("Αμερικανών")); + Assertions.assertEquals("στρατιωτ", stemmer.stem("στρατιωτών")); } @Test void testHungarian() { SnowballStemmer stemmer = new SnowballStemmer(ALGORITHM.HUNGARIAN); - Assertions.assertEquals(stemmer.stem("abbahagynám"), "abbahagyna"); - Assertions.assertEquals(stemmer.stem("konstrukciójából"), "konstrukció"); - Assertions.assertEquals(stemmer.stem("lopta"), "lopt"); + Assertions.assertEquals("abbahagyna", stemmer.stem("abbahagynám")); + Assertions.assertEquals("konstrukció", stemmer.stem("konstrukciójából")); + Assertions.assertEquals("lopt", stemmer.stem("lopta")); } @Test void testIrish() { SnowballStemmer stemmer = new SnowballStemmer(ALGORITHM.IRISH); - Assertions.assertEquals(stemmer.stem("bhfeidhm"), "feidhm"); - Assertions.assertEquals(stemmer.stem("feirmeoireacht"), "feirmeoir"); - Assertions.assertEquals(stemmer.stem("monarcacht"), "monarc"); + Assertions.assertEquals("feidhm", stemmer.stem("bhfeidhm")); + Assertions.assertEquals("feirmeoir", stemmer.stem("feirmeoireacht")); + Assertions.assertEquals("monarc", stemmer.stem("monarcacht")); } @Test void testItalian() { SnowballStemmer stemmer = new SnowballStemmer(ALGORITHM.ITALIAN); - Assertions.assertEquals(stemmer.stem("abbattimento"), "abbatt"); - Assertions.assertEquals(stemmer.stem("dancer"), "dancer"); - Assertions.assertEquals(stemmer.stem("dance"), "danc"); + Assertions.assertEquals("abbatt", stemmer.stem("abbattimento")); + Assertions.assertEquals("dancer", stemmer.stem("dancer")); + Assertions.assertEquals("danc", stemmer.stem("dance")); } @Test void testIndonesian() { SnowballStemmer stemmer = new SnowballStemmer(ALGORITHM.INDONESIAN); - Assertions.assertEquals(stemmer.stem("peledakan"), "ledak"); - Assertions.assertEquals(stemmer.stem("pelajaran"), "ajar"); - Assertions.assertEquals(stemmer.stem("perbaikan"), "baik"); + Assertions.assertEquals("ledak", stemmer.stem("peledakan")); + Assertions.assertEquals("ajar", stemmer.stem("pelajaran")); + Assertions.assertEquals("baik", stemmer.stem("perbaikan")); } @Test void testPortuguese() { SnowballStemmer stemmer = new SnowballStemmer(ALGORITHM.PORTUGUESE); - Assertions.assertEquals(stemmer.stem("aborrecimentos"), "aborrec"); - Assertions.assertEquals(stemmer.stem("aché"), "aché"); - Assertions.assertEquals(stemmer.stem("ache"), "ache"); + Assertions.assertEquals("aborrec", stemmer.stem("aborrecimentos")); + Assertions.assertEquals("aché", stemmer.stem("aché")); + Assertions.assertEquals("ache", stemmer.stem("ache")); } @Test void testRomanian() { SnowballStemmer stemmer = new SnowballStemmer(ALGORITHM.ROMANIAN); - Assertions.assertEquals(stemmer.stem("absurdităţilor"), "absurd"); - Assertions.assertEquals(stemmer.stem("laşi"), "laș"); - Assertions.assertEquals(stemmer.stem("saracilor"), "sarac"); + Assertions.assertEquals("absurd", stemmer.stem("absurdităţilor")); + Assertions.assertEquals("laș", stemmer.stem("laşi")); + Assertions.assertEquals("sarac", stemmer.stem("saracilor")); } @Test void testSpanish() { SnowballStemmer stemmer = new SnowballStemmer(ALGORITHM.SPANISH); - Assertions.assertEquals(stemmer.stem("besó"), "bes"); - Assertions.assertEquals(stemmer.stem("importantísimas"), "importantisim"); - Assertions.assertEquals(stemmer.stem("incidental"), "incidental"); + Assertions.assertEquals("bes", stemmer.stem("besó")); + Assertions.assertEquals("importantisim", stemmer.stem("importantísimas")); + Assertions.assertEquals("incidental", stemmer.stem("incidental")); } @Test void testSwedish() { SnowballStemmer stemmer = new SnowballStemmer(ALGORITHM.SWEDISH); - Assertions.assertEquals(stemmer.stem("aftonringningen"), "aftonringning"); - Assertions.assertEquals(stemmer.stem("andedrag"), "andedrag"); - Assertions.assertEquals(stemmer.stem("andedrägt"), "andedräg"); + Assertions.assertEquals("aftonringning", stemmer.stem("aftonringningen")); + Assertions.assertEquals("andedrag", stemmer.stem("andedrag")); + Assertions.assertEquals("andedräg", stemmer.stem("andedrägt")); } @Test void testTurkish() { SnowballStemmer stemmer = new SnowballStemmer(ALGORITHM.TURKISH); - Assertions.assertEquals(stemmer.stem("ab'yle"), "ab'yle"); - Assertions.assertEquals(stemmer.stem("kaçmamaktadır"), "kaçmamak"); - Assertions.assertEquals(stemmer.stem("sarayı'nı"), "sarayı'nı"); + Assertions.assertEquals("ab'yle", stemmer.stem("ab'yle")); + Assertions.assertEquals("kaçmamak", stemmer.stem("kaçmamaktadır")); + Assertions.assertEquals("sarayı'nı", stemmer.stem("sarayı'nı")); } @Test diff --git a/opennlp-tools/src/test/java/opennlp/tools/tokenize/TokenSampleTest.java b/opennlp-tools/src/test/java/opennlp/tools/tokenize/TokenSampleTest.java index c0e95d48..f3883a82 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/tokenize/TokenSampleTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/tokenize/TokenSampleTest.java @@ -129,6 +129,6 @@ public class TokenSampleTest { Assertions.assertNotSame(createGoldSample(), createGoldSample()); Assertions.assertEquals(createGoldSample(), createGoldSample()); Assertions.assertNotEquals(createPredSample(), createGoldSample()); - Assertions.assertNotEquals(createPredSample(), new Object()); + Assertions.assertNotEquals(new Object(), createPredSample()); } } diff --git a/opennlp-tools/src/test/java/opennlp/tools/util/TrainingParametersTest.java b/opennlp-tools/src/test/java/opennlp/tools/util/TrainingParametersTest.java index dd05af6e..b5de2139 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/util/TrainingParametersTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/util/TrainingParametersTest.java @@ -176,12 +176,12 @@ public class TrainingParametersTest { Assertions.assertEquals(123, tp.getIntParameter("int", "k2", -100)); Assertions.assertEquals(-100, tp.getIntParameter("int", "k4", -100)); - Assertions.assertEquals(tp.getDoubleParameter("k21", -100), 0.001, 234.5); + Assertions.assertEquals(0.001, tp.getDoubleParameter("k21", -100), 234.5); tp.put("k21", 345.6); - Assertions.assertEquals(tp.getDoubleParameter("k21", -100), 0.001, 345.6); // should be changed + Assertions.assertEquals(0.001, tp.getDoubleParameter("k21", -100), 345.6); // should be changed tp.putIfAbsent("k21", 456.7); - Assertions.assertEquals(tp.getDoubleParameter("k21", -100), 0.001, 345.6); // should be unchanged - Assertions.assertEquals(tp.getDoubleParameter("double", "k5", -100), 0.001, 123.45); + Assertions.assertEquals(0.001, tp.getDoubleParameter("k21", -100), 345.6); // should be unchanged + Assertions.assertEquals(0.001, tp.getDoubleParameter("double", "k5", -100), 123.45); Assertions.assertTrue(tp.getBooleanParameter("k31", true)); tp.put("k31", false); diff --git a/opennlp-tools/src/test/java/opennlp/tools/util/featuregen/GeneratorFactoryTest.java b/opennlp-tools/src/test/java/opennlp/tools/util/featuregen/GeneratorFactoryTest.java index 8fb08bea..8ccac7d0 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/util/featuregen/GeneratorFactoryTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/util/featuregen/GeneratorFactoryTest.java @@ -161,9 +161,9 @@ public class GeneratorFactoryTest { TestParametersFeatureGenerator featureGenerator = (TestParametersFeatureGenerator) generator; Assertions.assertEquals(123, featureGenerator.ip); - Assertions.assertEquals(featureGenerator.fp, 0.1, 45); + Assertions.assertEquals(0.1, featureGenerator.fp, 45); Assertions.assertEquals(67890, featureGenerator.lp); - Assertions.assertEquals(featureGenerator.dp, 0.1, 123456.789); + Assertions.assertEquals(0.1, featureGenerator.dp, 123456.789); Assertions.assertTrue(featureGenerator.bp); Assertions.assertEquals("HELLO", featureGenerator.sp); }
