Skip to content

Commit

Permalink
fix sonar by adding test going through new codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
zalborzi committed Jul 26, 2024
1 parent 17f659a commit 00d8696
Showing 1 changed file with 47 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@

package io.github.genomicdatainfrastructure.discovery.services;

import io.github.genomicdatainfrastructure.discovery.model.ContactPoints;
import io.github.genomicdatainfrastructure.discovery.model.DatasetDictionaryEntry;
import io.github.genomicdatainfrastructure.discovery.model.DatasetRelationEntry;
import io.github.genomicdatainfrastructure.discovery.model.RetrievedDataset;
import io.github.genomicdatainfrastructure.discovery.model.RetrievedDistribution;
import io.github.genomicdatainfrastructure.discovery.model.ValueLabel;
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.*;
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanContactPoints;
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanDatasetDictionaryEntry;
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanDatasetRelationEntry;
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanOrganization;
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanPackage;
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanResource;
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanTag;
import io.github.genomicdatainfrastructure.discovery.remote.ckan.model.CkanValueLabel;
import io.github.genomicdatainfrastructure.discovery.utils.PackageShowMapper;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -95,6 +105,24 @@ void can_parse() {
.lastModified("2024-03-19T13:37:05.472970")
.build()
))
.contacts(List.of(
CkanContactPoints.builder().name("Contact 1").email("[email protected]")
.build(),
CkanContactPoints.builder().name("Contact 2").email("[email protected]")
.build()
))
.datasetRelationships(List.of(
CkanDatasetRelationEntry.builder().target("Dataset 1").relation(
"Relation 1").build(),
CkanDatasetRelationEntry.builder().target("Dataset 2").relation(
"Relation 2").build()
))
.dataDictionary(List.of(
CkanDatasetDictionaryEntry.builder().name("Entry 1").type("Type 1")
.description("Description 1").build(),
CkanDatasetDictionaryEntry.builder().name("Entry 2").type("Type 2")
.description("Description 2").build()
))
.build();

var actual = PackageShowMapper.from(ckanPackage);
Expand Down Expand Up @@ -151,9 +179,24 @@ void can_parse() {
.modifiedAt(parse("2024-03-19T13:37:05.472970", DATE_FORMATTER))
.build()
))
.contacts(List.of())
.datasetRelationships(List.of())
.dataDictionary(List.of())
.contacts(List.of(
ContactPoints.builder().name("Contact 1").email("[email protected]")
.build(),
ContactPoints.builder().name("Contact 2").email("[email protected]")
.build()
))
.datasetRelationships(List.of(
DatasetRelationEntry.builder().relation("Relation 1").target("Dataset 1")
.build(),
DatasetRelationEntry.builder().relation("Relation 2").target("Dataset 2")
.build()
))
.dataDictionary(List.of(
DatasetDictionaryEntry.builder().name("Entry 1").type("Type 1").description(
"Description 1").build(),
DatasetDictionaryEntry.builder().name("Entry 2").type("Type 2").description(
"Description 2").build()
))
.build();

assertThat(actual)
Expand Down

0 comments on commit 00d8696

Please sign in to comment.