Skip to content

Commit

Permalink
Refactor NihmsSubmissionEtlITBase to include title, doi, and issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tsande16 committed Jul 8, 2024
1 parent df22988 commit a196970
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
@Testcontainers
@DirtiesContext
public abstract class NihmsSubmissionEtlITBase {
//including high ascii to test for ascii handling
protected final String title = "Article A ε4";
protected final String doi = "10.1000/a.abcd.1234";
protected final String issue = "3";

static {
MavenXpp3Reader reader = new MavenXpp3Reader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@
*/
public class TransformAndLoadCompliantIT extends NihmsSubmissionEtlITBase {
private final String pmcid1 = "PMC12345678";
private final String title = "Article A";
private final String doi = "10.1000/a.abcd.1234";
private final String issue = "3";

protected String pmid1;
protected String awardNumber1;
protected String nihmsId1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@
*/
public class TransformAndLoadInProcessIT extends NihmsSubmissionEtlITBase {
private final String nihmsId1 = "NIHMS987654321";
private final String title = "Article A";
private final String doi = "10.1000/a.abcd.1234";
private final String issue = "3";

/**
* Tests when the publication is completely new and is an in-process
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@
@ExtendWith(MockitoExtension.class)
public class TransformAndLoadNonCompliantIT extends NihmsSubmissionEtlITBase {
private final String nihmsId1 = "NIHMS987654321";
private final String title = "Article A";
private final String doi = "10.1000/a.abcd.1234";
private final String issue = "3";


/**
* Tests when the publication is completely new and is non-compliant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,25 +89,7 @@ public void testGetPubMedRecord() throws IOException {

PubMedEntrezRecord record = pmidLookup.retrievePubMedRecord(pmid);
assertEquals("10.1000/a.abcd.1234", record.getDoi());
//test to ensure that it can handle high ascii characters
assertEquals("Article A ε4", record.getTitle());
}

@Test
public void testGetPubMedRecordWithHighAsciiChars() throws IOException {
String entrez = IOUtils.toString(getClass().getClassLoader().
getResourceAsStream("pmid_record_ascii.json"), StandardCharsets.UTF_8);

String pmid = "11111111";

stubFor(get(urlPathEqualTo("/entrez/eutils/esummary.fcgi"))
.withQueryParam("db", WireMock.equalTo("pubmed"))
.withQueryParam("retmode", WireMock.equalTo("json"))
.withQueryParam("rettype", WireMock.equalTo("abstract"))
.withQueryParam("id", WireMock.equalTo(pmid))
.willReturn(aResponse().withStatus(200).withBody(entrez)));

PubMedEntrezRecord record = pmidLookup.retrievePubMedRecord(pmid);
assertEquals("10.1002/acn3.333", record.getDoi());
assertEquals("Age-dependent effects of APOE ε4 in preclinical Alzheimer's disease.", record.getTitle());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
}
],
"lastauthor": "Fuchsia A",
"title": "Article A",
"sorttitle": "Article A",
"title": "Article A ε4",
"volume": "140",
"issue": "3",
"pages": "111-113",
Expand Down

0 comments on commit a196970

Please sign in to comment.