/* * Extracts media files from Fedora repository * Copyright (C) 2020 Memoriav * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package ch.memobase import ch.memobase.models.BinaryResourceMetadata import org.scalatest.funsuite.AnyFunSuite import scala.io.Source class BinaryResourceMetadataTest extends AnyFunSuite { val externalBaseUrl = "https://memobase.ch" private def loadMessage: String = { val file = Source.fromFile("src/test/resources/incoming_message_with_binary.json") val result = file.mkString .replaceAll(raw"\{\{eventType\}\}", "Create") .replaceAll(raw"\{\{mimeType\}\}", "image/jpeg") file.close() result } test("the value of the id field of a KafkaMessage should match the id of the parsed object") { val km = BinaryResourceMetadata.build(loadMessage, externalBaseUrl) assert(km.get.id == "BAZ-MEI_77466-1") } }