From 593e1b0811e4c11d6e80e8921cf62a0114d3e242 Mon Sep 17 00:00:00 2001
From: kbeyro <121854496+kbeyro@users.noreply.github.com>
Date: Mon, 26 May 2025 12:41:43 +0200
Subject: [PATCH] update test

---
 .../impl/DashboardServiceImplTest.java        | 59 +++++++++----------
 1 file changed, 29 insertions(+), 30 deletions(-)

diff --git a/src/test/java/net/geant/nmaas/portal/service/impl/DashboardServiceImplTest.java b/src/test/java/net/geant/nmaas/portal/service/impl/DashboardServiceImplTest.java
index 089913263..f35951e6c 100644
--- a/src/test/java/net/geant/nmaas/portal/service/impl/DashboardServiceImplTest.java
+++ b/src/test/java/net/geant/nmaas/portal/service/impl/DashboardServiceImplTest.java
@@ -128,36 +128,35 @@ public class DashboardServiceImplTest {
     }
 
     @Test
-void getSystemDashboardShouldCalculateCorrectTimestamps() {
-    OffsetDateTime startDate = OffsetDateTime.now().minusHours(5);
-    OffsetDateTime endDate = OffsetDateTime.now();
-
-    // Mock required repository methods
-    when(domainRepository.count()).thenReturn(1L);
-    when(userRepository.count()).thenReturn(1L);
-    when(appInstanceRepo.count()).thenReturn(1L);
-    when(appInstanceRepo.countAllDeployedSinceTime(org.mockito.ArgumentMatchers.anyLong(), org.mockito.ArgumentMatchers.anyLong())).thenReturn(1);
-    when(applicationBaseRepository.findAllNames()).thenReturn(Collections.emptyList());
-    when(appInstanceRepo.findAllInTimePeriod(org.mockito.ArgumentMatchers.anyLong(), org.mockito.ArgumentMatchers.anyLong())).thenReturn(Collections.emptyList());
-
-    // Call the method
-    dashboardService.getSystemDashboard(startDate, endDate);
-
-    // Capture the arguments
-    ArgumentCaptor<Long> startCaptor = ArgumentCaptor.forClass(Long.class);
-    ArgumentCaptor<Long> endCaptor = ArgumentCaptor.forClass(Long.class);
-
-    // Verify that the method was called with calculated timestamps
-    org.mockito.Mockito.verify(appInstanceRepo).countAllDeployedSinceTime(startCaptor.capture(), endCaptor.capture());
-
-    long startTimestamp = startCaptor.getValue();
-    long endTimestamp = endCaptor.getValue();
-
-    // The timestamps should be positive and start should be greater than end (since it's calculated as now - toEpochSecond)
-    assert startTimestamp > 0;
-    assert endTimestamp > 0;
-    assert startTimestamp > endTimestamp;
-}
+    void getSystemDashboardShouldCalculateCorrectTimestamps() {
+        OffsetDateTime startDate = OffsetDateTime.now().minusHours(5);
+        OffsetDateTime endDate = OffsetDateTime.now();
+
+        // Mock required repository methods
+        when(domainRepository.count()).thenReturn(1L);
+        when(userRepository.count()).thenReturn(1L);
+        when(appInstanceRepo.count()).thenReturn(1L);
+        when(appInstanceRepo.countAllDeployedSinceTime(org.mockito.ArgumentMatchers.anyLong(), org.mockito.ArgumentMatchers.anyLong())).thenReturn(1);
+        when(applicationBaseRepository.findAllNames()).thenReturn(Collections.emptyList());
+        when(appInstanceRepo.findAllInTimePeriod(org.mockito.ArgumentMatchers.anyLong(), org.mockito.ArgumentMatchers.anyLong())).thenReturn(Collections.emptyList());
+
+        // Call the method
+        dashboardService.getSystemDashboard(startDate, endDate);
+
+        // Capture the arguments
+        ArgumentCaptor<Long> startCaptor = ArgumentCaptor.forClass(Long.class);
+        ArgumentCaptor<Long> endCaptor = ArgumentCaptor.forClass(Long.class);
+
+        org.mockito.Mockito.verify(appInstanceRepo).countAllDeployedSinceTime(startCaptor.capture(), endCaptor.capture());
+
+        long startTimestamp = startCaptor.getValue();
+        long endTimestamp = endCaptor.getValue();
+
+        // The timestamps should be positive and start should be less than or equal to end
+        assert startTimestamp > 0;
+        assert endTimestamp > 0;
+        assert startTimestamp <= endTimestamp;
+    }
 
     @Test
     void countAllDeployedSinceTimeShouldReturnCorrectCount() {
-- 
GitLab