Skip to content

Commit

Permalink
Added unittest for source_file and source_file_path, but the
Browse files Browse the repository at this point in the history
embedder-solr unittest is disabled. When fixed the unittest will be
active.
  • Loading branch information
Thomas Egense committed Dec 23, 2023
1 parent ac4e362 commit efe0ad2
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
*/

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -61,6 +62,7 @@
import uk.bl.wa.annotation.Annotations;
import uk.bl.wa.annotation.AnnotationsTest;
import uk.bl.wa.annotation.Annotator;
import uk.bl.wa.solr.SolrFields;
import uk.bl.wa.solr.SolrRecord;
import uk.bl.wa.util.Normalisation;

Expand Down Expand Up @@ -191,6 +193,12 @@ public void testEmbeddedServer() throws SolrServerException, IOException, NoSuch
}
assertEquals(21L, response.getResults().getNumFound());

//Test source_file and source_file_path
SolrDocument doc = response.getResults().get(0);
assertEquals(doc.getFieldValue(SolrFields.SOURCE_FILE),"flashfrozen-jwat-recompressed.warc.gz");
String source_file_path = (String) doc.getFieldValue(SolrFields.SOURCE_FILE_PATH);
assertTrue(source_file_path.endsWith("wikipedia-mona-lisa/flashfrozen-jwat-recompressed.warc.gz")); //First path of path depend on project location.

}

}

0 comments on commit efe0ad2

Please sign in to comment.