From c6941f33757d146185a61dc7d247ff257c32d020 Mon Sep 17 00:00:00 2001
From: Martin Weise <martin.weise@tuwien.ac.at>
Date: Tue, 29 Nov 2022 16:55:44 +0100
Subject: [PATCH] Attempt to fix test

---
 .../endpoint/TableEndpointUnitTest.java       | 23 +++++++++++++++++++
 .../service/TableServiceIntegrationTest.java  | 21 ++++++++++++-----
 2 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/fda-table-service/rest-service/src/test/java/at/tuwien/endpoint/TableEndpointUnitTest.java b/fda-table-service/rest-service/src/test/java/at/tuwien/endpoint/TableEndpointUnitTest.java
index deeba0e24b..a2aa475ca8 100644
--- a/fda-table-service/rest-service/src/test/java/at/tuwien/endpoint/TableEndpointUnitTest.java
+++ b/fda-table-service/rest-service/src/test/java/at/tuwien/endpoint/TableEndpointUnitTest.java
@@ -1,9 +1,13 @@
 package at.tuwien.endpoint;
 
 import at.tuwien.BaseUnitTest;
+import at.tuwien.config.IndexInitializer;
 import at.tuwien.config.ReadyConfig;
 import at.tuwien.endpoints.TableEndpoint;
+import at.tuwien.entities.database.table.Table;
 import at.tuwien.exception.DatabaseNotFoundException;
+import at.tuwien.repository.elastic.TableColumnidxRepository;
+import at.tuwien.repository.elastic.TableidxRepository;
 import at.tuwien.service.DatabaseService;
 import com.rabbitmq.client.Channel;
 import org.apache.http.auth.BasicUserPrincipal;
@@ -16,6 +20,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
 
 import javax.ws.rs.NotAllowedException;
 import java.security.Principal;
+import java.util.List;
 
 import static org.junit.jupiter.api.Assertions.*;
 import static org.mockito.Mockito.*;
@@ -36,6 +41,24 @@ public class TableEndpointUnitTest extends BaseUnitTest {
     @MockBean
     private Channel channel;
 
+    /**
+     * ElasticSearch not required in this test
+     */
+    @MockBean
+    private IndexInitializer indexInitializer;
+
+    /**
+     * ElasticSearch not required in this test
+     */
+    @MockBean
+    private TableidxRepository tableidxRepository;
+
+    /**
+     * ElasticSearch not required in this test
+     */
+    @MockBean
+    private TableColumnidxRepository tableColumnidxRepository;
+
     @MockBean
     private DatabaseService databaseService;
 
diff --git a/fda-table-service/rest-service/src/test/java/at/tuwien/service/TableServiceIntegrationTest.java b/fda-table-service/rest-service/src/test/java/at/tuwien/service/TableServiceIntegrationTest.java
index 572d9155c3..8adc36c551 100644
--- a/fda-table-service/rest-service/src/test/java/at/tuwien/service/TableServiceIntegrationTest.java
+++ b/fda-table-service/rest-service/src/test/java/at/tuwien/service/TableServiceIntegrationTest.java
@@ -45,18 +45,33 @@ import static org.mockito.Mockito.when;
 @ExtendWith(SpringExtension.class)
 public class TableServiceIntegrationTest extends BaseUnitTest {
 
+    /**
+     * RabbitMQ not required in this test
+     */
     @MockBean
     private ReadyConfig readyConfig;
 
+    /**
+     * RabbitMQ not required in this test
+     */
     @MockBean
     private Channel channel;
 
+    /**
+     * ElasticSearch not required in this test
+     */
     @MockBean
     private IndexInitializer indexInitializer;
 
+    /**
+     * ElasticSearch not required in this test
+     */
     @MockBean
     private TableidxRepository tableidxRepository;
 
+    /**
+     * ElasticSearch not required in this test
+     */
     @MockBean
     private TableColumnidxRepository tableColumnidxRepository;
 
@@ -75,12 +90,6 @@ public class TableServiceIntegrationTest extends BaseUnitTest {
     @Autowired
     private TableService tableService;
 
-    @Autowired
-    private UserRepository userRepository;
-
-    @Autowired
-    private ImageEnvironmentRepository imageEnvironmentRepository;
-
     @BeforeAll
     public static void beforeAll() throws InterruptedException {
         afterAll();
-- 
GitLab