From 4d5466828dab4fca70261f993cd731bfc82e4852 Mon Sep 17 00:00:00 2001 From: Martin Weise <martin.weise@tuwien.ac.at> Date: Mon, 29 Jan 2024 13:22:50 +0100 Subject: [PATCH] Updated problematic code piece --- .../at/tuwien/endpoints/StoreEndpointUnitTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/StoreEndpointUnitTest.java b/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/StoreEndpointUnitTest.java index 5b1278f33c..5145c8136a 100644 --- a/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/StoreEndpointUnitTest.java +++ b/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/StoreEndpointUnitTest.java @@ -261,8 +261,8 @@ public class StoreEndpointUnitTest extends BaseUnitTest { @Test @WithMockUser(username = USER_1_USERNAME, authorities = "persist-query") public void persist_ownWriteAll_succeeds() throws UserNotFoundException, QueryStoreException, - NotAllowedException, DatabaseConnectionException, QueryNotFoundException, DatabaseNotFoundException, - ImageNotSupportedException, AccessDeniedException, IdentifierAlreadyPublishedException { + NotAllowedException, QueryNotFoundException, DatabaseNotFoundException, ImageNotSupportedException, + AccessDeniedException, IdentifierAlreadyPublishedException { /* mock */ when(userRepository.findByUsername(USER_1_USERNAME)) @@ -296,8 +296,7 @@ public class StoreEndpointUnitTest extends BaseUnitTest { protected QueryDto persist_generic(Long databaseId, Database database, Long queryId, Query query, UUID userId, Principal principal, DatabaseAccess access) throws DatabaseNotFoundException, UserNotFoundException, QueryStoreException, QueryNotFoundException, - ImageNotSupportedException, NotAllowedException, DatabaseConnectionException, - AccessDeniedException, IdentifierAlreadyPublishedException { + ImageNotSupportedException, NotAllowedException, AccessDeniedException, IdentifierAlreadyPublishedException { final QueryPersistDto request = QueryPersistDto.builder() .persist(true) .build(); @@ -307,8 +306,9 @@ public class StoreEndpointUnitTest extends BaseUnitTest { .thenReturn(database); when(storeService.findOne(databaseId, queryId, principal)) .thenReturn(query); - when(storeService.persist(databaseId, queryId, request)) - .thenReturn(query); + doReturn(query) + .when(storeService) + .persist(databaseId, queryId, request); if (access != null) { log.trace("mock access for database with id {} and user id {}", databaseId, userId); when(accessService.find(databaseId, userId)) -- GitLab