Skip to content

Commit

Permalink
WIP - Integration tests #8
Browse files Browse the repository at this point in the history
  • Loading branch information
djtfmartin committed Jun 27, 2024
1 parent e7ef55a commit 1280a6e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
8 changes: 8 additions & 0 deletions matching-ws/src/main/resources/datasets.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"prefix": "urn:lsid:ipni.org:names:",
"prefixMapping": [
"http://marinespecies.org/data.php?id=",
"https://marinespecies.org/data.php?id=",
"https://www.marinespecies.org/aphia.php?p=taxdetails&id="
]
},
Expand All @@ -33,5 +34,12 @@
"gbifKey": "dbaa27eb-29e7-4cbb-8eab-3f689cfce116",
"title": "UK Species Inventory",
"prefix": "NBN"
},
{
"key": "2041",
"gbifKey": "de8934f4-a136-481c-a87a-b0b202b80a31",
"title": "Dyntaxa. Svensk taxonomisk databas",
"prefix": "Dyntaxa"
}

]
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public static void buildMatcher() throws IOException {
dataset.setAlias("DUMMY_IDS");
dataset.setTitle("Dummy dataset for testing");
dataset.setPrefix("ext-");
dataset.setPrefixMapping(List.of("other-ext-", "other-ext2-"));
dataset.setTaxonCount(counts[0]);
dataset.setMatchesToMainIndex(counts[1]);
datasetIndex.initWithIdentifierDir(dataset, joinIndex);
Expand All @@ -79,6 +80,16 @@ public void testJoinHigherTaxa(){
@Test
public void testJoinLeafTaxa(){

NameUsageMatch match1 = matcher.match(
null, "ext-6", null, null, null, null,
null,null,null, null, null, null,
false, false
);

assertNotNull(match1);
assertNotNull(match1.getUsage());
assertEquals("1011638", match1.getUsage().getKey());

NameUsageMatch match2 = matcher.match(
null, null, null, null, "Abacion tesselatum", null,
null,null,null, null, null, null,
Expand All @@ -90,6 +101,30 @@ public void testJoinLeafTaxa(){
assertEquals("1011638", match2.getUsage().getKey());
}

@Test
public void testJoinLeafTaxaWithPrefix(){

NameUsageMatch match1 = matcher.match(
null, "other-ext-", null, null, "Abacion tesselatum", null,
null,null,null, null, null, null,
false, false
);

assertNotNull(match1);
assertNotNull(match1.getUsage());
assertEquals("1011638", match1.getUsage().getKey());

NameUsageMatch match2 = matcher.match(
null, "other-ext2-", null, null, "Abacion tesselatum", null,
null,null,null, null, null, null,
false, false
);

assertNotNull(match2);
assertNotNull(match2.getUsage());
assertEquals("1011638", match2.getUsage().getKey());
}

@Test
public void testIDandNameInconsistent(){

Expand Down

0 comments on commit 1280a6e

Please sign in to comment.