From 94063c8dfde3bfa98d33b98edbfc63aff51a3551 Mon Sep 17 00:00:00 2001 From: Sam Leeflang Date: Wed, 2 Nov 2022 14:59:22 +0100 Subject: [PATCH 1/2] Add unit tests and integration tests --- pom.xml | 52 +++++++- .../repository/DigitalSpecimenRepository.java | 12 +- .../service/ProcessingService.java | 4 +- .../repository/BaseRepositoryIT.java | 44 +++++++ .../DigitalSpecimenRepositoryIT.java | 122 ++++++++++++++++++ .../repository/HandleRepositoryIT.java | 74 +++++++++++ .../service/HandleServiceTest.java | 5 +- .../service/ProcessingServiceTest.java | 1 + .../utils/TestUtils.java | 18 ++- .../resources/db/migration/V1__init_db.sql | 41 ++++++ 10 files changed, 351 insertions(+), 22 deletions(-) create mode 100644 src/test/java/eu/dissco/core/digitalspecimenprocessor/repository/BaseRepositoryIT.java create mode 100644 src/test/java/eu/dissco/core/digitalspecimenprocessor/repository/DigitalSpecimenRepositoryIT.java create mode 100644 src/test/java/eu/dissco/core/digitalspecimenprocessor/repository/HandleRepositoryIT.java create mode 100644 src/test/resources/db/migration/V1__init_db.sql diff --git a/pom.xml b/pom.xml index dfef3b0..ca4d724 100644 --- a/pom.xml +++ b/pom.xml @@ -20,6 +20,7 @@ 2.1.1 1.13 16.1.1 + 1.17.5 dissco https://sonarcloud.io ../app-it/target/site/jacoco-aggregate/jacoco.xml @@ -34,6 +35,13 @@ import pom + + org.testcontainers + testcontainers-bom + ${testcontainers.version} + import + pom + @@ -115,6 +123,26 @@ 4.8.0 test + + org.testcontainers + testcontainers + test + + + org.testcontainers + postgresql + test + + + org.testcontainers + junit-jupiter + test + + + org.flywaydb + flyway-core + test + @@ -135,19 +163,33 @@ prepare-agent + + prepare-agent-integration + + prepare-agent-integration + + report + prepare-package report - - - XML - - + + + report-integration + + report-integration + + + maven-failsafe-plugin + + false + + org.jooq jooq-codegen-maven diff --git a/src/main/java/eu/dissco/core/digitalspecimenprocessor/repository/DigitalSpecimenRepository.java b/src/main/java/eu/dissco/core/digitalspecimenprocessor/repository/DigitalSpecimenRepository.java index 6122259..6223f93 100644 --- a/src/main/java/eu/dissco/core/digitalspecimenprocessor/repository/DigitalSpecimenRepository.java +++ b/src/main/java/eu/dissco/core/digitalspecimenprocessor/repository/DigitalSpecimenRepository.java @@ -24,15 +24,6 @@ public class DigitalSpecimenRepository { private final DSLContext context; private final ObjectMapper mapper; - public Optional getDigitalSpecimen(String physicalSpecimenId) { - return context.select(NEW_DIGITAL_SPECIMEN.asterisk()) - .distinctOn(NEW_DIGITAL_SPECIMEN.ID) - .from(NEW_DIGITAL_SPECIMEN) - .where(NEW_DIGITAL_SPECIMEN.PHYSICAL_SPECIMEN_ID.eq(physicalSpecimenId)) - .orderBy(NEW_DIGITAL_SPECIMEN.ID, NEW_DIGITAL_SPECIMEN.VERSION.desc()) - .fetchOptional(this::mapDigitalSpecimen); - } - private DigitalSpecimenRecord mapDigitalSpecimen(Record dbRecord) { DigitalSpecimen digitalSpecimen = null; try { @@ -83,7 +74,8 @@ private Query specimenToQuery(DigitalSpecimenRecord digitalSpecimenRecord) { .set(NEW_DIGITAL_SPECIMEN.SOURCE_SYSTEM_ID, digitalSpecimenRecord.digitalSpecimen().sourceSystemId()) .set(NEW_DIGITAL_SPECIMEN.CREATED, digitalSpecimenRecord.created()) - .set(NEW_DIGITAL_SPECIMEN.LAST_CHECKED, Instant.now()).set(NEW_DIGITAL_SPECIMEN.DATA, + .set(NEW_DIGITAL_SPECIMEN.LAST_CHECKED, Instant.now()) + .set(NEW_DIGITAL_SPECIMEN.DATA, JSONB.valueOf(digitalSpecimenRecord.digitalSpecimen().data().toString())) .set(NEW_DIGITAL_SPECIMEN.ORIGINAL_DATA, JSONB.valueOf(digitalSpecimenRecord.digitalSpecimen().originalData().toString())) diff --git a/src/main/java/eu/dissco/core/digitalspecimenprocessor/service/ProcessingService.java b/src/main/java/eu/dissco/core/digitalspecimenprocessor/service/ProcessingService.java index b44e2db..50b3163 100644 --- a/src/main/java/eu/dissco/core/digitalspecimenprocessor/service/ProcessingService.java +++ b/src/main/java/eu/dissco/core/digitalspecimenprocessor/service/ProcessingService.java @@ -97,7 +97,9 @@ private Set updateExistingDigitalSpecimen( var handleUpdates = updatedDigitalSpecimenTuples.stream().filter( tuple -> handleNeedsUpdate(tuple.currentSpecimen().digitalSpecimen(), tuple.digitalSpecimen())).toList(); - handleService.updateHandles(handleUpdates); + if (!handleUpdates.isEmpty()){ + handleService.updateHandles(handleUpdates); + } var digitalSpecimenRecords = updatedDigitalSpecimenTuples.stream().collect(Collectors.toMap( tuple -> new DigitalSpecimenRecord( diff --git a/src/test/java/eu/dissco/core/digitalspecimenprocessor/repository/BaseRepositoryIT.java b/src/test/java/eu/dissco/core/digitalspecimenprocessor/repository/BaseRepositoryIT.java new file mode 100644 index 0000000..89e403b --- /dev/null +++ b/src/test/java/eu/dissco/core/digitalspecimenprocessor/repository/BaseRepositoryIT.java @@ -0,0 +1,44 @@ +package eu.dissco.core.digitalspecimenprocessor.repository; + +import static org.testcontainers.containers.PostgreSQLContainer.IMAGE; + +import com.zaxxer.hikari.HikariDataSource; +import org.flywaydb.core.Flyway; +import org.jooq.DSLContext; +import org.jooq.SQLDialect; +import org.jooq.impl.DefaultDSLContext; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.junit.jupiter.Container; +import org.testcontainers.junit.jupiter.Testcontainers; +import org.testcontainers.utility.DockerImageName; + +@Testcontainers +public class BaseRepositoryIT { + + private static final DockerImageName POSTGIS = + DockerImageName.parse("postgres:13.7").asCompatibleSubstituteFor(IMAGE); + + @Container + private static final PostgreSQLContainer CONTAINER = new PostgreSQLContainer<>(POSTGIS); + protected DSLContext context; + private HikariDataSource dataSource; + + @BeforeEach + void prepareDatabase() { + dataSource = new HikariDataSource(); + dataSource.setJdbcUrl(CONTAINER.getJdbcUrl()); + dataSource.setUsername(CONTAINER.getUsername()); + dataSource.setPassword(CONTAINER.getPassword()); + dataSource.setMaximumPoolSize(1); + dataSource.setConnectionInitSql(CONTAINER.getTestQueryString()); + Flyway.configure().mixed(true).dataSource(dataSource).load().migrate(); + context = new DefaultDSLContext(dataSource, SQLDialect.POSTGRES); + } + + @AfterEach + void disposeDataSource() { + dataSource.close(); + } +} diff --git a/src/test/java/eu/dissco/core/digitalspecimenprocessor/repository/DigitalSpecimenRepositoryIT.java b/src/test/java/eu/dissco/core/digitalspecimenprocessor/repository/DigitalSpecimenRepositoryIT.java new file mode 100644 index 0000000..ddf67a4 --- /dev/null +++ b/src/test/java/eu/dissco/core/digitalspecimenprocessor/repository/DigitalSpecimenRepositoryIT.java @@ -0,0 +1,122 @@ +package eu.dissco.core.digitalspecimenprocessor.repository; + +import static eu.dissco.core.digitalspecimenprocessor.database.jooq.Tables.NEW_DIGITAL_SPECIMEN; +import static eu.dissco.core.digitalspecimenprocessor.utils.TestUtils.HANDLE; +import static eu.dissco.core.digitalspecimenprocessor.utils.TestUtils.MAPPER; +import static eu.dissco.core.digitalspecimenprocessor.utils.TestUtils.PHYSICAL_SPECIMEN_ID; +import static eu.dissco.core.digitalspecimenprocessor.utils.TestUtils.givenDigitalSpecimenRecord; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockito.Mockito.mockStatic; + +import java.sql.BatchUpdateException; +import java.time.Instant; +import java.util.List; +import org.jooq.Record1; +import org.jooq.exception.DataAccessException; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.MockedStatic; +import org.postgresql.util.PSQLException; + +class DigitalSpecimenRepositoryIT extends BaseRepositoryIT { + + private static final Instant UPDATED_TIMESTAMP = Instant.parse("2022-11-02T13:05:24.00Z"); + + + private DigitalSpecimenRepository repository; + + @BeforeEach + void setup() { + repository = new DigitalSpecimenRepository(context, MAPPER); + } + + @AfterEach + void destroy() { + context.truncate(NEW_DIGITAL_SPECIMEN).execute(); + } + + @Test + void testGetDigitalSpecimensEmpty() { + // Given + + // When + var result = repository.getDigitalSpecimens(List.of(PHYSICAL_SPECIMEN_ID)); + + // Then + assertThat(result).isEmpty(); + } + + @Test + void testGetDigitalSpecimens() { + // Given + repository.createDigitalSpecimenRecord( + List.of( + givenDigitalSpecimenRecord(), + givenDigitalSpecimenRecord("20.5000.1025/XXX-XXX-XXX", "TEST_1"), + givenDigitalSpecimenRecord("20.5000.1025/YYY-YYY-YYY", "TEST_2"))); + + // When + var result = repository.getDigitalSpecimens(List.of(PHYSICAL_SPECIMEN_ID)); + + // Then + assertThat(result.get(0)).isEqualTo(givenDigitalSpecimenRecord()); + } + + @Test + void testUpdateVersionSpecimens() { + // Given + repository.createDigitalSpecimenRecord( + List.of( + givenDigitalSpecimenRecord(), + givenDigitalSpecimenRecord("20.5000.1025/XXX-XXX-XXX", "TEST_1"), + givenDigitalSpecimenRecord("20.5000.1025/YYY-YYY-YYY", "TEST_2"))); + + // When + repository.createDigitalSpecimenRecord(List.of(givenDigitalSpecimenRecord(2))); + + // Then + } + + @Test + void testUpdateLastChecked() { + // Given + repository.createDigitalSpecimenRecord( + List.of( + givenDigitalSpecimenRecord(), + givenDigitalSpecimenRecord("20.5000.1025/XXX-XXX-XXX", "TEST_1"), + givenDigitalSpecimenRecord("20.5000.1025/YYY-YYY-YYY", "TEST_2"))); + + // When + try (MockedStatic mockedStatic = mockStatic(Instant.class)) { + mockedStatic.when(Instant::now).thenReturn(UPDATED_TIMESTAMP); + repository.updateLastChecked(List.of(HANDLE)); + } + + // Then + var result = context.select(NEW_DIGITAL_SPECIMEN.LAST_CHECKED) + .from(NEW_DIGITAL_SPECIMEN) + .where(NEW_DIGITAL_SPECIMEN.ID.eq(HANDLE)).fetchOne(Record1::value1); + assertThat(result).isEqualTo(UPDATED_TIMESTAMP); + } + + @Test + void testInsertDuplicateSpecimens() { + // Given + var records = List.of( + givenDigitalSpecimenRecord(), + givenDigitalSpecimenRecord("20.5000.1025/XXX-XXX-XXX", "TEST_1"), + givenDigitalSpecimenRecord("20.5000.1025/XXX-XXX-XXX", "TEST_2")); + + // When + var exception = assertThrows(DataAccessException.class, () -> { + repository.createDigitalSpecimenRecord(records); + }); + + // Then + assertThat(exception).hasCauseInstanceOf(BatchUpdateException.class).hasRootCauseInstanceOf( + PSQLException.class); + } + +} diff --git a/src/test/java/eu/dissco/core/digitalspecimenprocessor/repository/HandleRepositoryIT.java b/src/test/java/eu/dissco/core/digitalspecimenprocessor/repository/HandleRepositoryIT.java new file mode 100644 index 0000000..04b97cb --- /dev/null +++ b/src/test/java/eu/dissco/core/digitalspecimenprocessor/repository/HandleRepositoryIT.java @@ -0,0 +1,74 @@ +package eu.dissco.core.digitalspecimenprocessor.repository; + +import static eu.dissco.core.digitalspecimenprocessor.database.jooq.Tables.HANDLES; +import static eu.dissco.core.digitalspecimenprocessor.utils.TestUtils.CREATED; +import static eu.dissco.core.digitalspecimenprocessor.utils.TestUtils.HANDLE; +import static org.assertj.core.api.Assertions.assertThat; + +import eu.dissco.core.digitalspecimenprocessor.domain.HandleAttribute; +import java.nio.charset.StandardCharsets; +import java.util.List; +import org.jooq.Record1; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class HandleRepositoryIT extends BaseRepositoryIT { + + private HandleRepository repository; + + @BeforeEach + void setup() { + repository = new HandleRepository(context); + } + + @AfterEach + void destroy() { + context.truncate(HANDLES).execute(); + } + + @Test + void testCreateHandle() { + // Given + var handleAttributes = givenHandleAttributes(); + + // When + repository.createHandle(HANDLE, CREATED, handleAttributes); + + // Then + var handles = context.selectFrom(HANDLES).fetch(); + assertThat(handles).hasSize(handleAttributes.size()); + } + + @Test + void testUpdateHandleAttributes(){ + // Given + var handleAttributes = givenHandleAttributes(); + repository.createHandle(HANDLE, CREATED, handleAttributes); + var updatedHandle = new HandleAttribute(11, "pidKernelMetadataLicense", + "anotherLicenseType".getBytes(StandardCharsets.UTF_8)); + + // When + repository.updateHandleAttributes(HANDLE, CREATED, List.of(updatedHandle)); + + // Then + var result = context.select(HANDLES.DATA) + .from(HANDLES) + .where(HANDLES.HANDLE.eq(HANDLE.getBytes(StandardCharsets.UTF_8))) + .and(HANDLES.TYPE.eq("issueNumber".getBytes(StandardCharsets.UTF_8))) + .fetchOne(Record1::value1); + assertThat(result).isEqualTo("2".getBytes(StandardCharsets.UTF_8)); + } + + private List givenHandleAttributes() { + return List.of( + new HandleAttribute(1, "pid", + ("https://hdl.handle.net/" + HANDLE).getBytes(StandardCharsets.UTF_8)), + new HandleAttribute(11, "pidKernelMetadataLicense", + "https://creativecommons.org/publicdomain/zero/1.0/".getBytes(StandardCharsets.UTF_8)), + new HandleAttribute(7, "issueNumber", "1".getBytes(StandardCharsets.UTF_8)), + new HandleAttribute(100, "HS_ADMIN", "TEST_ADMIN_STRING".getBytes(StandardCharsets.UTF_8)) + ); + } + +} diff --git a/src/test/java/eu/dissco/core/digitalspecimenprocessor/service/HandleServiceTest.java b/src/test/java/eu/dissco/core/digitalspecimenprocessor/service/HandleServiceTest.java index 3576bbd..2746db5 100644 --- a/src/test/java/eu/dissco/core/digitalspecimenprocessor/service/HandleServiceTest.java +++ b/src/test/java/eu/dissco/core/digitalspecimenprocessor/service/HandleServiceTest.java @@ -4,7 +4,6 @@ import static eu.dissco.core.digitalspecimenprocessor.utils.TestUtils.HANDLE; import static eu.dissco.core.digitalspecimenprocessor.utils.TestUtils.MAPPER; import static eu.dissco.core.digitalspecimenprocessor.utils.TestUtils.givenDigitalSpecimen; -import static eu.dissco.core.digitalspecimenprocessor.utils.TestUtils.givenDigitalSpecimenRecord; import static eu.dissco.core.digitalspecimenprocessor.utils.TestUtils.givenUnequalDigitalSpecimenRecord; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.anyList; @@ -76,7 +75,9 @@ void testUpdateHandle() { // Given // When - service.updateHandles(List.of(new UpdatedDigitalSpecimenTuple(givenUnequalDigitalSpecimenRecord(), givenDigitalSpecimen()))); + service.updateHandles(List.of( + new UpdatedDigitalSpecimenTuple(givenUnequalDigitalSpecimenRecord(), + givenDigitalSpecimen()))); // Then then(repository).should().updateHandleAttributes(eq(HANDLE), eq(CREATED), anyList()); diff --git a/src/test/java/eu/dissco/core/digitalspecimenprocessor/service/ProcessingServiceTest.java b/src/test/java/eu/dissco/core/digitalspecimenprocessor/service/ProcessingServiceTest.java index fd22c42..f48ddc9 100644 --- a/src/test/java/eu/dissco/core/digitalspecimenprocessor/service/ProcessingServiceTest.java +++ b/src/test/java/eu/dissco/core/digitalspecimenprocessor/service/ProcessingServiceTest.java @@ -92,6 +92,7 @@ void testUnequalSpecimen() throws IOException { var result = service.handleMessages(List.of(givenDigitalSpecimenEvent())); // Then + then(handleService).shouldHaveNoInteractions(); then(repository).should().createDigitalSpecimenRecord(expected); then(kafkaService).should() .publishUpdateEvent(givenDigitalSpecimenRecord(2), givenUnequalDigitalSpecimenRecord()); diff --git a/src/test/java/eu/dissco/core/digitalspecimenprocessor/utils/TestUtils.java b/src/test/java/eu/dissco/core/digitalspecimenprocessor/utils/TestUtils.java index e5d2463..f905116 100644 --- a/src/test/java/eu/dissco/core/digitalspecimenprocessor/utils/TestUtils.java +++ b/src/test/java/eu/dissco/core/digitalspecimenprocessor/utils/TestUtils.java @@ -126,7 +126,17 @@ public static DigitalSpecimenRecord givenUnequalDigitalSpecimenRecord() { MIDS_LEVEL, VERSION, CREATED, - givenDigitalSpecimen("Another SpecimenName") + givenDigitalSpecimen(PHYSICAL_SPECIMEN_ID, "Another SpecimenName") + ); + } + + public static DigitalSpecimenRecord givenDigitalSpecimenRecord(String handle, String physicalSpecimenId) { + return new DigitalSpecimenRecord( + handle, + MIDS_LEVEL, + VERSION, + CREATED, + givenDigitalSpecimen(physicalSpecimenId, SPECIMEN_NAME) ); } @@ -138,13 +148,13 @@ public static DigitalSpecimenEvent givenDigitalSpecimenEvent() { } public static DigitalSpecimen givenDigitalSpecimen() { - return givenDigitalSpecimen(SPECIMEN_NAME); + return givenDigitalSpecimen(PHYSICAL_SPECIMEN_ID, SPECIMEN_NAME); } - public static DigitalSpecimen givenDigitalSpecimen(String specimenName) { + public static DigitalSpecimen givenDigitalSpecimen(String physicalSpecimenId, String specimenName) { return new DigitalSpecimen( TYPE, - PHYSICAL_SPECIMEN_ID, + physicalSpecimenId, PHYSICAL_SPECIMEN_TYPE, specimenName, ORGANIZATION_ID, diff --git a/src/test/resources/db/migration/V1__init_db.sql b/src/test/resources/db/migration/V1__init_db.sql new file mode 100644 index 0000000..3228558 --- /dev/null +++ b/src/test/resources/db/migration/V1__init_db.sql @@ -0,0 +1,41 @@ +CREATE TABLE public.new_digital_specimen ( + id text NOT NULL, + "version" int4 NOT NULL, + "type" text NOT NULL, + midslevel int2 NOT NULL, + physical_specimen_id text NOT NULL, + physical_specimen_type text NOT NULL, + specimen_name text NULL, + organization_id text NOT NULL, + physical_specimen_collection text NULL, + dataset text NULL, + source_system_id text NOT NULL, + created timestamptz NOT NULL, + last_checked timestamptz NOT NULL, + deleted timestamptz NULL, + "data" jsonb NULL, + original_data jsonb NULL, + dwca_id text NULL, + CONSTRAINT new_digital_specimen_pkey PRIMARY KEY (id, version) +); +CREATE INDEX new_digital_specimen_created_idx ON public.new_digital_specimen USING btree (created); +CREATE INDEX new_digital_specimen_id_idx ON public.new_digital_specimen USING btree (id, created); +CREATE INDEX new_digital_specimen_physical_specimen_id_idx ON public.new_digital_specimen USING btree (physical_specimen_id); + +CREATE TABLE public.handles ( + handle bytea NOT NULL, + idx int4 NOT NULL, + "type" bytea NULL, + "data" bytea NULL, + ttl_type int2 NULL, + ttl int4 NULL, + "timestamp" int8 NULL, + refs text NULL, + admin_read bool NULL, + admin_write bool NULL, + pub_read bool NULL, + pub_write bool NULL, + CONSTRAINT handles_pkey PRIMARY KEY (handle, idx) +); +CREATE INDEX dataindex ON public.handles USING btree (data); +CREATE INDEX handleindex ON public.handles USING btree (handle); \ No newline at end of file From b8969dbe22c28cf5c732c41489536f1cb4534892 Mon Sep 17 00:00:00 2001 From: Sam Leeflang Date: Wed, 2 Nov 2022 15:09:10 +0100 Subject: [PATCH 2/2] Sonar issues --- .github/workflows/build.yaml | 2 +- .../repository/DigitalSpecimenRepository.java | 4 ++-- .../repository/DigitalSpecimenRepositoryIT.java | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d5f907a..1d065b9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -36,7 +36,7 @@ jobs: run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=DiSSCo_${{ github.event.repository.name }} -Dsonar.exclusions=**/jooq/** - -Dsonar.coverage.exclusions=**/properties/**,**/configuration/** + -Dsonar.coverage.exclusions=**/properties/**,**/configuration/**,**/domain/**,**/exception/** - name: Login to Public ECR if: github.event_name != 'pull_request' uses: docker/login-action@v1 diff --git a/src/main/java/eu/dissco/core/digitalspecimenprocessor/repository/DigitalSpecimenRepository.java b/src/main/java/eu/dissco/core/digitalspecimenprocessor/repository/DigitalSpecimenRepository.java index 6223f93..67d01dc 100644 --- a/src/main/java/eu/dissco/core/digitalspecimenprocessor/repository/DigitalSpecimenRepository.java +++ b/src/main/java/eu/dissco/core/digitalspecimenprocessor/repository/DigitalSpecimenRepository.java @@ -9,7 +9,6 @@ import java.time.Instant; import java.util.Collection; import java.util.List; -import java.util.Optional; import lombok.RequiredArgsConstructor; import org.jooq.DSLContext; import org.jooq.JSONB; @@ -49,7 +48,8 @@ private DigitalSpecimenRecord mapDigitalSpecimen(Record dbRecord) { digitalSpecimen); } - public int[] createDigitalSpecimenRecord(Collection digitalSpecimenRecords) { + public int[] createDigitalSpecimenRecord( + Collection digitalSpecimenRecords) { var queries = digitalSpecimenRecords.stream().map(this::specimenToQuery).toList(); return context.batch(queries).execute(); } diff --git a/src/test/java/eu/dissco/core/digitalspecimenprocessor/repository/DigitalSpecimenRepositoryIT.java b/src/test/java/eu/dissco/core/digitalspecimenprocessor/repository/DigitalSpecimenRepositoryIT.java index ddf67a4..383c280 100644 --- a/src/test/java/eu/dissco/core/digitalspecimenprocessor/repository/DigitalSpecimenRepositoryIT.java +++ b/src/test/java/eu/dissco/core/digitalspecimenprocessor/repository/DigitalSpecimenRepositoryIT.java @@ -74,9 +74,10 @@ void testUpdateVersionSpecimens() { givenDigitalSpecimenRecord("20.5000.1025/YYY-YYY-YYY", "TEST_2"))); // When - repository.createDigitalSpecimenRecord(List.of(givenDigitalSpecimenRecord(2))); + var result = repository.createDigitalSpecimenRecord(List.of(givenDigitalSpecimenRecord(2))); // Then + assertThat(result).isEqualTo(new int[]{1}); } @Test