diff --git a/app/src/test/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/fit/enums/GarminSportTest.java b/app/src/test/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/fit/enums/GarminSportTest.java
index c74f69aa61..26b7e223d3 100644
--- a/app/src/test/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/fit/enums/GarminSportTest.java
+++ b/app/src/test/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/fit/enums/GarminSportTest.java
@@ -1,5 +1,21 @@
package nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.enums;
+/* Copyright (C) 2024-2026 José Rebelo, Thomas Kuehne
+
+ This file is part of Gadgetbridge.
+
+ Gadgetbridge is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Gadgetbridge is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see . */
import static org.junit.Assert.assertTrue;
import android.util.Pair;
@@ -7,8 +23,10 @@ import android.util.Pair;
import org.junit.Test;
import java.util.HashSet;
+import java.util.Optional;
import java.util.Set;
+import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
import nodomain.freeyourgadget.gadgetbridge.test.TestBase;
public class GarminSportTest extends TestBase {
@@ -28,4 +46,16 @@ public class GarminSportTest extends TestBase {
assertTrue("Duplicated sport codes: " + duplicates, duplicates.isEmpty());
}
+
+ // Ensure that every GarminSport has a subsport=0 fallback
+ @Test
+ public void testFallbackSport() {
+ int defaultIcon = ActivityKind.ACTIVITY.getIcon();
+ for (final GarminSport sport : GarminSport.values()) {
+ if (sport.getSubtype() != 0) {
+ Optional fallback = GarminSport.fromCodes(sport.getType(), 0);
+ assertTrue(sport.name() + " has no fallback", fallback.isPresent());
+ }
+ }
+ }
}