add demo endpoint for notification mocks
LocationBasedServices/sumoc-backend/pipeline/head This commit looks good

This commit is contained in:
2026-01-13 12:22:44 +01:00
parent f1a214b5db
commit ba642d10a5
13 changed files with 120 additions and 29 deletions
@@ -0,0 +1,8 @@
package SuMoC.backend.regulartrip.detectionapproaches;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
public class IterativeClustererTest {
}
@@ -1,8 +1,8 @@
package SuMoC.backend.trend.services;
import SuMoC.backend.trend.TrendDetection;
import SuMoC.backend.trend.WeeklyMobilityStatsRepository;
import SuMoC.backend.trend.config.TrendDetectionProperties;
import SuMoC.backend.trend.dto.TrendDetectionDTO;
import SuMoC.backend.trend.enums.DeltaType;
import SuMoC.backend.trend.enums.StatAttribute;
import SuMoC.backend.trend.enums.TrendTimespan;
@@ -77,13 +77,13 @@ public class TrendDetectorServiceTest {
.thenReturn(List.of(user1Current, user2Current, user3Current));
// Act
List<TrendDetection> detectedTrends = trendDetectorService.detectWeeklyTrends(year, weekNumber, StatAttribute.CAR_DISTANCE);
List<TrendDetectionDTO> detectedTrends = trendDetectorService.detectWeeklyTrends(year, weekNumber, StatAttribute.CAR_DISTANCE);
// Assert
assertEquals(2, detectedTrends.size(), "Should detect 2 trends (1 increase, 1 decrease)");
// Verify increasing trend for user1
TrendDetection user1Trend = detectedTrends.stream()
TrendDetectionDTO user1Trend = detectedTrends.stream()
.filter(t -> t.getUser().getId().equals(user1.getId()))
.findFirst()
.orElse(null);
@@ -95,7 +95,7 @@ public class TrendDetectorServiceTest {
assertEquals(300.0, user1Trend.getChangeValue(), 0.01);
// Verify decreasing trend for user2
TrendDetection user2Trend = detectedTrends.stream()
TrendDetectionDTO user2Trend = detectedTrends.stream()
.filter(t -> t.getUser().getId().equals(user2.getId()))
.findFirst()
.orElse(null);
@@ -131,7 +131,7 @@ public class TrendDetectorServiceTest {
// Act & Assert - should not throw any exception
assertDoesNotThrow(() -> {
List<TrendDetection> detectedTrends = trendDetectorService.detectWeeklyTrends(year, weekNumber, StatAttribute.CAR_DISTANCE);
List<TrendDetectionDTO> detectedTrends = trendDetectorService.detectWeeklyTrends(year, weekNumber, StatAttribute.CAR_DISTANCE);
assertEquals(0, detectedTrends.size(), "Should not detect any trends when matching data is missing");
});
}