You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by to...@apache.org on 2017/04/11 15:12:43 UTC
lucene-solr:master: LUCENE-7776 - visualize diff btwn BytesRef values
in ClassificationTestBase
Repository: lucene-solr
Updated Branches:
refs/heads/master 1bf369622 -> 9c00fc679
LUCENE-7776 - visualize diff btwn BytesRef values in ClassificationTestBase
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/9c00fc67
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/9c00fc67
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/9c00fc67
Branch: refs/heads/master
Commit: 9c00fc6795228f8938fe1601697835b5acdd8290
Parents: 1bf3696
Author: Tommaso Teofili <to...@apache.org>
Authored: Tue Apr 11 17:12:13 2017 +0200
Committer: Tommaso Teofili <to...@apache.org>
Committed: Tue Apr 11 17:12:13 2017 +0200
----------------------------------------------------------------------
.../apache/lucene/classification/ClassificationTestBase.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9c00fc67/lucene/classification/src/test/org/apache/lucene/classification/ClassificationTestBase.java
----------------------------------------------------------------------
diff --git a/lucene/classification/src/test/org/apache/lucene/classification/ClassificationTestBase.java b/lucene/classification/src/test/org/apache/lucene/classification/ClassificationTestBase.java
index 331a74b..6c8f7fd 100644
--- a/lucene/classification/src/test/org/apache/lucene/classification/ClassificationTestBase.java
+++ b/lucene/classification/src/test/org/apache/lucene/classification/ClassificationTestBase.java
@@ -88,8 +88,9 @@ public abstract class ClassificationTestBase<T> extends LuceneTestCase {
protected ClassificationResult<T> checkCorrectClassification(Classifier<T> classifier, String inputDoc, T expectedResult) throws Exception {
ClassificationResult<T> classificationResult = classifier.assignClass(inputDoc);
- assertNotNull(classificationResult.getAssignedClass());
- assertEquals("got an assigned class of " + classificationResult.getAssignedClass(), expectedResult, classificationResult.getAssignedClass());
+ T assignedClass = classificationResult.getAssignedClass();
+ assertNotNull(assignedClass);
+ assertEquals("got an assigned class of " + assignedClass, expectedResult instanceof BytesRef ? ((BytesRef) expectedResult).utf8ToString() : expectedResult, assignedClass instanceof BytesRef ? ((BytesRef) assignedClass).utf8ToString() : assignedClass);
double score = classificationResult.getScore();
assertTrue("score should be between 0 and 1, got:" + score, score <= 1 && score >= 0);
return classificationResult;