Commit 2389aa73 authored by Jonas Waeber's avatar Jonas Waeber

Add test which confirms that exception is thrown if the property in agent is invalid.

parent 4a04581c
Pipeline #21262 passed with stage
in 1 minute and 45 seconds
package ch.memobase.test
import ch.memobase.exceptions.InvalidMappingException
import ch.memobase.mapping.MapperParsers
import ch.memobase.mapping.mappers.AgentFieldMapper
import java.util.function.Consumer
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.assertThrows
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class TestMapperParseHelpers {
......@@ -81,28 +82,21 @@ class TestMapperParseHelpers {
.satisfies(mapperReqs)
}
// TODO: This throws an exception. Which needs to be handled. currently it will just fail the program.
@Test
@Disabled
fun `test extractAgentTypeMapper with different property`() {
val mappers = MapperParsers.buildAgentMapper(
"creators",
listOf(
mapOf(
Pair(
"person", mapOf(
Pair("people", "creatorPerson.name")
assertThrows<InvalidMappingException> {
MapperParsers.buildAgentMapper(
"creators",
listOf(
mapOf(
Pair(
"person", mapOf(
Pair("people", "creatorPerson.name")
)
)
)
)
)
)
val mapperReqs: Consumer<AgentFieldMapper> = Consumer { agentFieldMapper: AgentFieldMapper ->
assertThat(agentFieldMapper.sourceKey).isEqualTo("creators")
assertThat(agentFieldMapper.agentClassType).isEqualTo("person")
}
val mapper = mappers[0] as AgentFieldMapper
assertThat(mapper)
.satisfies(mapperReqs)
}
}
......@@ -5,6 +5,15 @@
@prefix ebucore: <http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
_:b0 a rico:CreationRelation ;
rico:creationRelationHasSource <https://memobase.ch/record/rs1-1> ;
rico:creationRelationHasTarget [ a rico:Person ;
rico:agentIsTargetOfCreationRelation
_:b0 ;
rico:name "Hans Zimmer"
] ;
rico:type "creator" .
<https://memobase.ch/record/rs1-1>
a rico:Record ;
rdau:P60451 <https://memobase.ch/institution/mrv> ;
......@@ -19,12 +28,3 @@
rico:recordResourceOrInstantiationIsSourceOfCreationRelation
_:b0 ;
rico:type "Foto" .
_:b0 a rico:CreationRelation ;
rico:creationRelationHasSource <https://memobase.ch/record/rs1-1> ;
rico:creationRelationHasTarget [ a rico:Person ;
rico:agentIsTargetOfCreationRelation
_:b0 ;
rico:name "Hans Zimmer"
] ;
rico:type "creator" .
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment