Skip to content

Commit

Permalink
[CST-14906] Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
atarix83 committed Sep 25, 2024
1 parent 59e6418 commit 1ca1379
Showing 1 changed file with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,6 @@ public void testProductWorkCreation() {

Item product = ItemBuilder.createItem(context, products)
.withTitle("Test dataset")
.withAuthor("Walter White")
.withAuthor("Jesse Pinkman")
.withEditor("Editor")
.withIssueDate("2021-04-30")
.withDescriptionAbstract("Product description")
Expand All @@ -215,6 +213,13 @@ public void testProductWorkCreation() {
.withPersonIdentifierLastName("Walter")
.withPersonIdentifierFirstName("White")
.build();
Item person2 = ItemBuilder.createItem(context, persons)
.withTitle("Jesse Pinkman")
.withIssueDate("2017-10-17")
.withAuthor("Jesse, Pinkman")
.withPersonIdentifierLastName("Jesse")
.withPersonIdentifierFirstName("Pinkman")
.build();

EntityType productType = EntityTypeBuilder.createEntityTypeBuilder(context, "Product").build();
EntityType personType = EntityTypeBuilder.createEntityTypeBuilder(context, "Person").build();
Expand All @@ -223,6 +228,7 @@ public void testProductWorkCreation() {
"isCreatorOfProduct", "isProductOfCreator", 0, null, 0, null).build();

RelationshipBuilder.createRelationshipBuilder(context, product, person, isCreatorOfProduct).build();
RelationshipBuilder.createRelationshipBuilder(context, product, person2, isCreatorOfProduct).build();

context.restoreAuthSystemState();

Expand All @@ -247,9 +253,9 @@ public void testProductWorkCreation() {

List<Contributor> contributors = work.getWorkContributors().getContributor();
assertThat(contributors, hasSize(2));
assertThat(contributors, has(contributor("Walter White", AUTHOR, FIRST)));
assertThat(contributors, has(contributor("Walter, White", AUTHOR, FIRST)));
// assertThat(contributors, has(contributor("Editor", EDITOR, FIRST)));
assertThat(contributors, has(contributor("Jesse Pinkman", AUTHOR, ADDITIONAL)));
assertThat(contributors, has(contributor("Jesse, Pinkman", AUTHOR, ADDITIONAL)));

assertThat(work.getExternalIdentifiers(), notNullValue());

Expand All @@ -268,7 +274,6 @@ public void testPatentWorkCreation() {

Item patent = ItemBuilder.createItem(context, patents)
.withTitle("Test patent")
.withAuthor("Jesse Pinkman")
.withIssueDate("2021-04-30")
.withDescriptionAbstract("Patent description")
.withPublisher("Patent registration office")
Expand All @@ -284,6 +289,13 @@ public void testPatentWorkCreation() {
.withPersonIdentifierLastName("Walter")
.withPersonIdentifierFirstName("White")
.build();
Item person2 = ItemBuilder.createItem(context, persons)
.withTitle("Jesse Pinkman")
.withIssueDate("2017-10-17")
.withAuthor("Jesse, Pinkman")
.withPersonIdentifierLastName("Jesse")
.withPersonIdentifierFirstName("Pinkman")
.build();

EntityType patentType = EntityTypeBuilder.createEntityTypeBuilder(context, "Patent").build();
EntityType personType = EntityTypeBuilder.createEntityTypeBuilder(context, "Person").build();
Expand All @@ -292,6 +304,7 @@ public void testPatentWorkCreation() {
"isInventorOfPatent", "isPatentOfInventor", 0, null, 0, null).build();

RelationshipBuilder.createRelationshipBuilder(context, patent, person, isInventorOfPatent).build();
RelationshipBuilder.createRelationshipBuilder(context, patent, person2, isInventorOfPatent).build();

context.restoreAuthSystemState();

Expand All @@ -305,8 +318,6 @@ public void testPatentWorkCreation() {
assertThat(work.getPublicationDate(), matches(date("2021", "04", "30")));
assertThat(work.getShortDescription(), is("Patent description"));
assertThat(work.getPutCode(), nullValue());
// assertThat(work.getWorkCitation(), notNullValue());
// assertThat(work.getWorkCitation().getCitation(), containsString("Test patent"));
assertThat(work.getWorkType(), is(WorkType.PATENT));
assertThat(work.getWorkTitle(), notNullValue());
assertThat(work.getWorkTitle().getTitle(), notNullValue());
Expand All @@ -315,8 +326,10 @@ public void testPatentWorkCreation() {
assertThat(work.getUrl(), matches(urlEndsWith(patent.getHandle())));

List<Contributor> contributors = work.getWorkContributors().getContributor();
assertThat(contributors, hasSize(1));
assertThat(contributors, has(contributor("Jesse Pinkman", AUTHOR, FIRST)));
assertThat(contributors, hasSize(2));
assertThat(contributors, has(contributor("Walter, White", AUTHOR, FIRST)));
// assertThat(contributors, has(contributor("Editor", EDITOR, FIRST)));
assertThat(contributors, has(contributor("Jesse, Pinkman", AUTHOR, ADDITIONAL)));

assertThat(work.getExternalIdentifiers(), notNullValue());

Expand Down

0 comments on commit 1ca1379

Please sign in to comment.