diff --git a/src/main/java/eu/dissco/core/translator/terms/utils/AgentsUtils.java b/src/main/java/eu/dissco/core/translator/terms/utils/AgentsUtils.java index b89e42e..44b6081 100644 --- a/src/main/java/eu/dissco/core/translator/terms/utils/AgentsUtils.java +++ b/src/main/java/eu/dissco/core/translator/terms/utils/AgentsUtils.java @@ -65,11 +65,11 @@ private static void handleMultipleAgents( List agents, String agentValue, String agentId, AgentRoleType role, Type type) { var ids = new String[0]; var agentValues = new String[0]; - if (checkIfNeedsParsing(agentValue)) { + if (needsParsing(agentValue)) { agentValues = Arrays.stream(agentValue.split("[&|]")).map(String::trim) .toArray(String[]::new); } - if (checkIfNeedsParsing(agentId)) { + if (needsParsing(agentId)) { ids = Arrays.stream(agentId.split("[&|]")).map(String::trim).toArray(String[]::new); } if (agentValues.length == ids.length) { @@ -97,7 +97,7 @@ private static void handleMultipleAgents( } } - private static boolean checkIfNeedsParsing(String value) { + private static boolean needsParsing(String value) { return value != null && (value.contains("&") || value.contains("|")); } } diff --git a/src/test/java/eu/dissco/core/translator/terms/utils/EntityRelationshipUtilsTest.java b/src/test/java/eu/dissco/core/translator/terms/utils/EntityRelationshipUtilsTest.java index a270e1a..c5a2c59 100644 --- a/src/test/java/eu/dissco/core/translator/terms/utils/EntityRelationshipUtilsTest.java +++ b/src/test/java/eu/dissco/core/translator/terms/utils/EntityRelationshipUtilsTest.java @@ -4,6 +4,7 @@ import static eu.dissco.core.translator.domain.RelationshipType.HAS_FDO_TYPE; import static eu.dissco.core.translator.domain.RelationshipType.HAS_ORGANISATION_ID; import static eu.dissco.core.translator.schema.Agent.Type.SCHEMA_SOFTWARE_APPLICATION; +import static eu.dissco.core.translator.terms.utils.AgentsUtils.addAgent; import static org.assertj.core.api.Assertions.assertThat; import eu.dissco.core.translator.domain.RelationshipType; @@ -73,7 +74,7 @@ private EntityRelationship createEntityRelationship(RelationshipType relationshi .withDwcRelatedResourceID(relatedResource) .withOdsRelatedResourceURI(relatedResourceURI) .withDwcRelationshipEstablishedDate(Date.from(Instant.now())) - .withOdsHasAgents(AgentsUtils.addAgent(List.of(), APP_NAME, APP_PID, + .withOdsHasAgents(addAgent(List.of(), APP_NAME, APP_PID, DATA_TRANSLATOR, SCHEMA_SOFTWARE_APPLICATION)); }