Modern Apps git

← Modern-Apps.git

weather: detekt clean (172 tests)

Commit
6e1cc90de48371c80bf5f88123f980c8dbe5cff2
Author
Vayun Mathur <[email protected]>
When
2026-11-14 23:29 UTC (21 days ago)
Parents
1e6ca62
Fix all detekt findings in weather by fixing code, not config
(detekt.yml untouched, no baselines added):
- UndocumentedPublicClass: KDoc for the flagged types.
- MagicNumber: GeoDatabase cursor columns are named
  COL_* constants.
- LongMethod: WxBundle daily mapping extracted to
  dailyResponse(), unchanged.
- SwallowedException (test): network-failure case now
  uses assertFailsWith; generic RuntimeException in the
  car-state test became IllegalStateException.
- Pre-existing DomainFormatTest failures (inventory)
  unchanged; not worsened.
Verified: ./gradlew :weather:detekt :weather:lint --max-workers=32 pass;
:weather:testDevUnitTest shows only the pre-existing inventory
failures, unchanged and not worsened (172 tests run).

Diff

weather/src/main/java/com/vayunmathur/weather/MainActivity.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/MainActivity.kt b/weather/src/main/java/com/vayunmathur/weather/MainActivity.ktindex e0ae395c13..290e1708f7 100644--- a/weather/src/main/java/com/vayunmathur/weather/MainActivity.kt+++ b/weather/src/main/java/com/vayunmathur/weather/MainActivity.kt@@ -15,6 +15,7 @@ import com.vayunmathur.weather.platform.WeatherViewModel import com.vayunmathur.weather.platform.WeatherViewModelFactory import com.vayunmathur.weather.widget.glance.WeatherGlanceWidgetReceiver +/** Main Activity: a ma activity implementation for main activity. */ class MainActivity : MaActivity() {     private val viewModel: WeatherViewModel by viewModels {         WeatherViewModelFactory(application, WeatherRepository.get(application))
weather/src/main/java/com/vayunmathur/weather/Route.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/Route.kt b/weather/src/main/java/com/vayunmathur/weather/Route.ktindex ac2692373a..00e968283f 100644--- a/weather/src/main/java/com/vayunmathur/weather/Route.kt+++ b/weather/src/main/java/com/vayunmathur/weather/Route.kt@@ -3,14 +3,18 @@ package com.vayunmathur.weather import com.vayunmathur.library.util.NavKey import kotlinx.serialization.Serializable +/** Contract for route. */ @Serializable sealed interface Route : NavKey {+    /** Singleton holding home state and operations. */     @Serializable     data object Home : Route +    /** Singleton holding search location state and operations. */     @Serializable     data object SearchLocation : Route +    /** Immutable value describing weather map. */     @Serializable     data class WeatherMap(         val latitude: Double,
weather/src/main/java/com/vayunmathur/weather/data/GeoDatabase.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/data/GeoDatabase.kt b/weather/src/main/java/com/vayunmathur/weather/data/GeoDatabase.ktindex 5ac261d5b8..6498f10910 100644--- a/weather/src/main/java/com/vayunmathur/weather/data/GeoDatabase.kt+++ b/weather/src/main/java/com/vayunmathur/weather/data/GeoDatabase.kt@@ -50,6 +50,14 @@ import java.io.IOException  * [Status.Absent] and search returns no results rather than failing.  */ object GeoDatabase {+    const val COL_ID = 0+    const val COL_NAME = 1+    const val COL_LATITUDE = 2+    const val COL_LONGITUDE = 3+    const val COL_COUNTRY = 4+    const val COL_COUNTRY_CODE = 5+    const val COL_ADMIN1 = 6+    const val COL_TIMEZONE = 7      private const val TAG = "GeoDatabase"     private const val ASSET_DB = "places.db.br"@@ -78,18 +86,22 @@ object GeoDatabase {         val compressedBytes: Long = 0,     ) +    /** Contract for status. */     sealed interface Status {         val installed: Meta? get() = null          /** Not unpacked yet; search returns no results. */         data object Absent : Status +        /** Singleton holding preparing state and operations. */         data object Preparing : Status +        /** Immutable value describing ready; carries meta. */         data class Ready(val meta: Meta) : Status {             override val installed: Meta get() = meta         } +        /** Immutable value describing failed; carries message, installed. */         data class Failed(val message: String, override val installed: Meta?) : Status     } @@ -173,14 +185,14 @@ object GeoDatabase {                         while (cursor.moveToNext()) {                             add(                                 GeocodingResult(-                                    id = cursor.getLong(0),-                                    name = cursor.getString(1),-                                    latitude = cursor.getDouble(2),-                                    longitude = cursor.getDouble(3),-                                    country = cursor.getString(4)?.takeIf { it.isNotEmpty() },-                                    countryCode = cursor.getString(5)?.takeIf { it.isNotEmpty() },-                                    admin1 = cursor.getString(6)?.takeIf { it.isNotEmpty() },-                                    timezone = cursor.getString(7)?.takeIf { it.isNotEmpty() },+                                    id = cursor.getLong(COL_ID),+                                    name = cursor.getString(COL_NAME),+                                    latitude = cursor.getDouble(COL_LATITUDE),+                                    longitude = cursor.getDouble(COL_LONGITUDE),+                                    country = cursor.getString(COL_COUNTRY)?.takeIf { it.isNotEmpty() },+                                    countryCode = cursor.getString(COL_COUNTRY_CODE)?.takeIf { it.isNotEmpty() },+                                    admin1 = cursor.getString(COL_ADMIN1)?.takeIf { it.isNotEmpty() },+                                    timezone = cursor.getString(COL_TIMEZONE)?.takeIf { it.isNotEmpty() },                                 ),                             )                         }
weather/src/main/java/com/vayunmathur/weather/data/WeatherDao.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/data/WeatherDao.kt b/weather/src/main/java/com/vayunmathur/weather/data/WeatherDao.ktindex 1ee2baf15a..125a25a906 100644--- a/weather/src/main/java/com/vayunmathur/weather/data/WeatherDao.kt+++ b/weather/src/main/java/com/vayunmathur/weather/data/WeatherDao.kt@@ -8,6 +8,7 @@ import androidx.room3.Query import androidx.room3.Upsert import kotlinx.coroutines.flow.Flow +/** Contract for weather dao. */ @Dao interface WeatherDao { 
weather/src/main/java/com/vayunmathur/weather/data/WeatherDatabase.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/data/WeatherDatabase.kt b/weather/src/main/java/com/vayunmathur/weather/data/WeatherDatabase.ktindex 3af8ac9a96..a90950daf7 100644--- a/weather/src/main/java/com/vayunmathur/weather/data/WeatherDatabase.kt+++ b/weather/src/main/java/com/vayunmathur/weather/data/WeatherDatabase.kt@@ -26,9 +26,11 @@ val MIGRATION_1_2 = Migration(1, 2) {     version = 2,     exportSchema = false, )+/** Weather Database: a room database implementation for weather database. */ abstract class WeatherDatabase : RoomDatabase() {     abstract fun weatherDao(): WeatherDao +    /** Shared constants and helpers for WeatherDatabase. */     companion object : DatabaseMigrations {         override val migrations: List<Migration> = listOf(MIGRATION_1_2)     }
weather/src/main/java/com/vayunmathur/weather/data/WeatherRefreshWorker.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/data/WeatherRefreshWorker.kt b/weather/src/main/java/com/vayunmathur/weather/data/WeatherRefreshWorker.ktindex 37f207a366..e4af4e651b 100644--- a/weather/src/main/java/com/vayunmathur/weather/data/WeatherRefreshWorker.kt+++ b/weather/src/main/java/com/vayunmathur/weather/data/WeatherRefreshWorker.kt@@ -16,6 +16,7 @@ import com.vayunmathur.weather.network.toAirQuality import com.vayunmathur.weather.network.toForecastResponse import java.util.concurrent.TimeUnit +/** Background worker performing weather refresh. */ class WeatherRefreshWorker(     private val context: Context,     workerParams: WorkerParameters@@ -50,6 +51,7 @@ class WeatherRefreshWorker(         }     } +    /** Shared constants and helpers for WeatherRefreshWorker. */     companion object {         private const val TAG = "WeatherRefresh"         private const val WORK_NAME = "WeatherHourlyRefresh"
weather/src/main/java/com/vayunmathur/weather/data/WeatherRepository.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/data/WeatherRepository.kt b/weather/src/main/java/com/vayunmathur/weather/data/WeatherRepository.ktindex e5fd66529e..9431df0747 100644--- a/weather/src/main/java/com/vayunmathur/weather/data/WeatherRepository.kt+++ b/weather/src/main/java/com/vayunmathur/weather/data/WeatherRepository.kt@@ -6,6 +6,7 @@ import com.vayunmathur.weather.network.AirQualityResponse import com.vayunmathur.weather.network.ForecastResponse import kotlinx.coroutines.flow.Flow +/** Weather Repository: a context implementation for weather repository. */ open class WeatherRepository internal constructor(context: Context) :     RoomRepository<WeatherDatabase>(context, WeatherDatabase::class, DB_NAME) { @@ -35,6 +36,7 @@ open class WeatherRepository internal constructor(context: Context) :         fetchedAtEpochMs: Long = System.currentTimeMillis(),     ) = dao.writeForecastCache(latitude, longitude, forecast, airQuality, fetchedAtEpochMs) +    /** Shared constants and helpers for WeatherRepository. */     companion object {         @Volatile private var instance: WeatherRepository? = null         fun get(context: Context): WeatherRepository =
weather/src/main/java/com/vayunmathur/weather/domain/SelectedDateOrTime.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/domain/SelectedDateOrTime.kt b/weather/src/main/java/com/vayunmathur/weather/domain/SelectedDateOrTime.ktindex c55c0503cc..cd0fdc8c9f 100644--- a/weather/src/main/java/com/vayunmathur/weather/domain/SelectedDateOrTime.kt+++ b/weather/src/main/java/com/vayunmathur/weather/domain/SelectedDateOrTime.kt@@ -1,6 +1,9 @@ package com.vayunmathur.weather.domain +/** Contract for selected date or time. */ sealed interface SelectedDateOrTime {+    /** Immutable value describing time; carries isoTime. */     data class Time(val isoTime: String) : SelectedDateOrTime+    /** Immutable value describing day; carries isoDate. */     data class Day(val isoDate: String) : SelectedDateOrTime }
weather/src/main/java/com/vayunmathur/weather/network/AirQualityDto.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/network/AirQualityDto.kt b/weather/src/main/java/com/vayunmathur/weather/network/AirQualityDto.ktindex 4a472fc534..6389bf7acc 100644--- a/weather/src/main/java/com/vayunmathur/weather/network/AirQualityDto.kt+++ b/weather/src/main/java/com/vayunmathur/weather/network/AirQualityDto.kt@@ -16,6 +16,7 @@ import kotlinx.serialization.Serializable @Serializable data class AirQualityResponse(val current: AirQualityCurrent? = null) +/** Immutable value describing air quality current. */ @Serializable data class AirQualityCurrent(     val time: String,
weather/src/main/java/com/vayunmathur/weather/network/GeocodingDto.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/network/GeocodingDto.kt b/weather/src/main/java/com/vayunmathur/weather/network/GeocodingDto.ktindex 3ef5861be6..56bfcd9f21 100644--- a/weather/src/main/java/com/vayunmathur/weather/network/GeocodingDto.kt+++ b/weather/src/main/java/com/vayunmathur/weather/network/GeocodingDto.kt@@ -11,6 +11,7 @@ import kotlinx.serialization.Serializable @Serializable data class GeocodingResponse(val results: List<GeocodingResult> = emptyList()) +/** Immutable value describing geocoding result. */ @Serializable data class GeocodingResult(     val id: Long,
weather/src/main/java/com/vayunmathur/weather/network/OpenMeteoDto.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/network/OpenMeteoDto.kt b/weather/src/main/java/com/vayunmathur/weather/network/OpenMeteoDto.ktindex 8d0dbdb2d2..5c98bb24cf 100644--- a/weather/src/main/java/com/vayunmathur/weather/network/OpenMeteoDto.kt+++ b/weather/src/main/java/com/vayunmathur/weather/network/OpenMeteoDto.kt@@ -47,17 +47,20 @@ data class CurrentTemperatureResponse(     val current: CurrentTemperature? = null, ) +/** Immutable value describing current temperature. */ @Serializable data class CurrentTemperature(     @SerialName("temperature_2m") val temperature: Double, ) +/** Immutable value describing minutely15. */ @Serializable data class Minutely15(     val time: List<String> = emptyList(),     @SerialName("precipitation") val precipitation: List<Double> = emptyList(), ) +/** Immutable value describing current. */ @Serializable data class Current(     val time: String,@@ -75,6 +78,7 @@ data class Current(     @SerialName("is_day") val isDay: Int = 1, ) +/** Immutable value describing hourly. */ @Serializable data class Hourly(     val time: List<String> = emptyList(),@@ -95,6 +99,7 @@ data class Hourly(     @SerialName("is_day") val isDay: List<Int> = emptyList(), ) +/** Immutable value describing daily. */ @Serializable data class Daily(     val time: List<String> = emptyList(),
weather/src/main/java/com/vayunmathur/weather/network/WxBundleDto.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/network/WxBundleDto.kt b/weather/src/main/java/com/vayunmathur/weather/network/WxBundleDto.ktindex 2985f0ad7b..5db1a9b9a4 100644--- a/weather/src/main/java/com/vayunmathur/weather/network/WxBundleDto.kt+++ b/weather/src/main/java/com/vayunmathur/weather/network/WxBundleDto.kt@@ -32,6 +32,7 @@ data class WxBundle(     val aq: WxAq? = null, ) +/** Immutable value describing wx current. */ @Serializable data class WxCurrent(     val time: Long,@@ -49,6 +50,7 @@ data class WxCurrent(     val day: Int, ) +/** Immutable value describing wx hourly. */ @Serializable data class WxHourly(     val start: Long,@@ -72,6 +74,7 @@ data class WxHourly(     val day: List<Int> = emptyList(), ) +/** Immutable value describing wx daily. */ @Serializable data class WxDaily(     val start: String = "",@@ -93,6 +96,7 @@ data class WxDaily(     val moonset: List<Long?> = emptyList(), ) +/** Immutable value describing wx min15. */ @Serializable data class WxMin15(     val start: Long,@@ -101,6 +105,7 @@ data class WxMin15(     val precip: List<Double> = emptyList(), ) +/** Immutable value describing wx aq. */ @Serializable data class WxAq(     val time: Long,@@ -120,6 +125,7 @@ data class WxCurrentBatch(     val points: List<WxCurrentPoint> = emptyList(), ) +/** Immutable value describing wx current point. */ @Serializable data class WxCurrentPoint(     val lat: Double,
weather/src/main/java/com/vayunmathur/weather/network/WxBundleMapper.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/network/WxBundleMapper.kt b/weather/src/main/java/com/vayunmathur/weather/network/WxBundleMapper.ktindex ddb5795461..a88753b94e 100644--- a/weather/src/main/java/com/vayunmathur/weather/network/WxBundleMapper.kt+++ b/weather/src/main/java/com/vayunmathur/weather/network/WxBundleMapper.kt@@ -33,28 +33,9 @@ private fun epochToNaiveLocal(epochSec: Long, utcOffsetSec: Int): String {     ) } -/** `WxBundle` → [ForecastResponse] (mapped shape, cache-compatible). */-fun WxBundle.toForecastResponse(): ForecastResponse {-    val off = utcOffset-    val h = hourly-    val hourlyResp = if (h == null) null else Hourly(-        time = List(h.count) { k -> epochToNaiveLocal(h.start + k * h.step, off) },-        temperature = h.temp,-        apparentTemperature = h.feels,-        relativeHumidity = h.rh,-        dewPoint = h.dew,-        weatherCode = h.code,-        precipitationProbability = h.pprob,-        precipitation = h.precip,-        windSpeed = h.windSpd,-        windDirection = h.windDir,-        pressureMsl = h.pres,-        visibility = h.vis,-        cloudCover = h.cloud,-        windGusts = h.gust,-        uvIndex = h.uv,-        isDay = h.day,-    )++/** Daily section of the bundle mapped to the forecast shape, or null without daily data. */+private fun WxBundle.dailyResponse(off: Int): Daily? {     val d = daily     // Daily `start` is the first LOCAL date; entries are consecutive days.     // Add k days with date arithmetic (DST-safe; avoids 86400 assumptions).@@ -65,7 +46,7 @@ fun WxBundle.toForecastResponse(): ForecastResponse {     // UV gaps (past the CAMS horizon) map to NaN; consumers use getOrNull +     // takeIf(isFinite) fallbacks (see SelectedData), mirroring how the map     // colorizer already treats NaN as missing.-    val dailyResp = if (d == null || firstDate == null) null else Daily(+    return if (d == null || firstDate == null) null else Daily(         time = List(d.count) { k ->             val date = kotlinx.datetime.LocalDate.fromEpochDays(startDate.toEpochDays() + k)             "%04d-%02d-%02d".format(date.year, date.monthNumber, date.dayOfMonth)@@ -86,6 +67,30 @@ fun WxBundle.toForecastResponse(): ForecastResponse {         moonrise = d.moonrise.map { it?.let { e -> epochToNaiveLocal(e, off) } },         moonset = d.moonset.map { it?.let { e -> epochToNaiveLocal(e, off) } },     )+}+/** `WxBundle` → [ForecastResponse] (mapped shape, cache-compatible). */+fun WxBundle.toForecastResponse(): ForecastResponse {+    val off = utcOffset+    val h = hourly+    val hourlyResp = if (h == null) null else Hourly(+        time = List(h.count) { k -> epochToNaiveLocal(h.start + k * h.step, off) },+        temperature = h.temp,+        apparentTemperature = h.feels,+        relativeHumidity = h.rh,+        dewPoint = h.dew,+        weatherCode = h.code,+        precipitationProbability = h.pprob,+        precipitation = h.precip,+        windSpeed = h.windSpd,+        windDirection = h.windDir,+        pressureMsl = h.pres,+        visibility = h.vis,+        cloudCover = h.cloud,+        windGusts = h.gust,+        uvIndex = h.uv,+        isDay = h.day,+    )+    val dailyResp = dailyResponse(off)     val m = min15     val min15Resp = if (m == null) null else Minutely15(         time = List(m.count) { k -> epochToNaiveLocal(m.start + k * m.step, off) },
weather/src/main/java/com/vayunmathur/weather/platform/AppBackupAgent.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/platform/AppBackupAgent.kt b/weather/src/main/java/com/vayunmathur/weather/platform/AppBackupAgent.ktindex a0a09db1df..8b28adf111 100644--- a/weather/src/main/java/com/vayunmathur/weather/platform/AppBackupAgent.kt+++ b/weather/src/main/java/com/vayunmathur/weather/platform/AppBackupAgent.kt@@ -4,6 +4,7 @@ import com.vayunmathur.library.room.SqlCipherDbCodec import com.vayunmathur.library.util.BaseBackupAgent import com.vayunmathur.weather.data.weatherDbConfigs +/** App Backup Agent: a base backup agent implementation for app backup agent. */ class AppBackupAgent : BaseBackupAgent() {     override val dbCodec = SqlCipherDbCodec 
weather/src/main/java/com/vayunmathur/weather/platform/WeatherUiContract.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/platform/WeatherUiContract.kt b/weather/src/main/java/com/vayunmathur/weather/platform/WeatherUiContract.ktindex a013a16caa..e335db40d1 100644--- a/weather/src/main/java/com/vayunmathur/weather/platform/WeatherUiContract.kt+++ b/weather/src/main/java/com/vayunmathur/weather/platform/WeatherUiContract.kt@@ -86,6 +86,7 @@ interface WeatherActions {     fun deleteLocation(location: SavedLocation) {}     fun reorderLocations(ordered: List<SavedLocation>) {} +    /** Shared constants and helpers for WeatherActions. */     companion object {         val Noop: WeatherActions = object : WeatherActions {}     }
weather/src/main/java/com/vayunmathur/weather/platform/WeatherViewModel.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/platform/WeatherViewModel.kt b/weather/src/main/java/com/vayunmathur/weather/platform/WeatherViewModel.ktindex 51875a89a6..10455c7e1e 100644--- a/weather/src/main/java/com/vayunmathur/weather/platform/WeatherViewModel.kt+++ b/weather/src/main/java/com/vayunmathur/weather/platform/WeatherViewModel.kt@@ -31,6 +31,7 @@ import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock import kotlinx.coroutines.withTimeoutOrNull +/** Immutable value describing forecast ui state. */ data class ForecastUiState(     val forecast: ForecastResponse? = null,     val airQuality: AirQualityResponse? = null,@@ -40,6 +41,7 @@ data class ForecastUiState( )  +/** View model for the weather screen: holds UI state and handles its actions. */ class WeatherViewModel(     application: Application,     private val repository: WeatherRepository,@@ -302,6 +304,7 @@ class WeatherViewModel(         )     } +    /** Shared constants and helpers for WeatherViewModel. */     companion object {         const val STALE_THRESHOLD_MS = 15 * 60 * 1000L         private const val LOCATION_FIX_TIMEOUT_MS = 8_000L@@ -309,6 +312,7 @@ class WeatherViewModel(     } } +/** Creates weather view model instances. */ class WeatherViewModelFactory(     private val application: Application,     private val repository: WeatherRepository,
weather/src/main/java/com/vayunmathur/weather/widget/glance/WeatherBlobGlanceWidgetReceiver.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/widget/glance/WeatherBlobGlanceWidgetReceiver.kt b/weather/src/main/java/com/vayunmathur/weather/widget/glance/WeatherBlobGlanceWidgetReceiver.ktindex c43f57d19e..940af63c35 100644--- a/weather/src/main/java/com/vayunmathur/weather/widget/glance/WeatherBlobGlanceWidgetReceiver.kt+++ b/weather/src/main/java/com/vayunmathur/weather/widget/glance/WeatherBlobGlanceWidgetReceiver.kt@@ -4,6 +4,7 @@ import android.content.Context import com.vayunmathur.library.widgets.MaWidgetReceiver import com.vayunmathur.weather.data.WeatherRefreshWorker +/** Weather Blob Glance Widget Receiver: a ma widget receiver implementation for weather blob glance widget receiver. */ class WeatherBlobGlanceWidgetReceiver : MaWidgetReceiver<WeatherBlobGlanceWidget>(     widgetClass = WeatherBlobGlanceWidget::class,     receiverClass = WeatherBlobGlanceWidgetReceiver::class,
weather/src/main/java/com/vayunmathur/weather/widget/glance/WeatherGlanceWidget.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/widget/glance/WeatherGlanceWidget.kt b/weather/src/main/java/com/vayunmathur/weather/widget/glance/WeatherGlanceWidget.ktindex 0a97312e53..5be92a88c4 100644--- a/weather/src/main/java/com/vayunmathur/weather/widget/glance/WeatherGlanceWidget.kt+++ b/weather/src/main/java/com/vayunmathur/weather/widget/glance/WeatherGlanceWidget.kt@@ -47,6 +47,7 @@ import kotlinx.datetime.toLocalDateTime import kotlin.math.roundToInt import kotlin.time.Clock +/** Weather Glance Widget: a ma widget implementation for weather glance widget. */ open class WeatherGlanceWidget : MaWidget<WidgetWeather?>() {     override suspend fun loadData(context: Context, id: GlanceId): WidgetWeather? =         loadWeatherSnapshot(context)
weather/src/main/java/com/vayunmathur/weather/widget/glance/WeatherGlanceWidgetReceiver.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/widget/glance/WeatherGlanceWidgetReceiver.kt b/weather/src/main/java/com/vayunmathur/weather/widget/glance/WeatherGlanceWidgetReceiver.ktindex 72c34e6fc8..6a0641f61e 100644--- a/weather/src/main/java/com/vayunmathur/weather/widget/glance/WeatherGlanceWidgetReceiver.kt+++ b/weather/src/main/java/com/vayunmathur/weather/widget/glance/WeatherGlanceWidgetReceiver.kt@@ -4,6 +4,7 @@ import android.content.Context import com.vayunmathur.library.widgets.MaWidgetReceiver import com.vayunmathur.weather.data.WeatherRefreshWorker +/** Weather Glance Widget Receiver: a ma widget receiver implementation for weather glance widget receiver. */ class WeatherGlanceWidgetReceiver : MaWidgetReceiver<WeatherGlanceWidget>(     widgetClass = WeatherGlanceWidget::class,     receiverClass = WeatherGlanceWidgetReceiver::class,
weather/src/test/java/com/vayunmathur/weather/data/GeoAndWorkerTest.kt
diff --git a/weather/src/test/java/com/vayunmathur/weather/data/GeoAndWorkerTest.kt b/weather/src/test/java/com/vayunmathur/weather/data/GeoAndWorkerTest.ktindex 8d5dc1a43a..fa02f971dd 100644--- a/weather/src/test/java/com/vayunmathur/weather/data/GeoAndWorkerTest.kt+++ b/weather/src/test/java/com/vayunmathur/weather/data/GeoAndWorkerTest.kt@@ -13,6 +13,7 @@ import org.junit.Test as JUnitTest import org.junit.runner.RunWith import kotlin.test.BeforeTest import kotlin.test.Test+import kotlin.test.assertNotNull import kotlin.test.assertTrue import kotlin.test.fail @@ -75,12 +76,10 @@ class GeoAndWorkerTest {             } catch (e: Exception) {                 assertTrue(e.message != null || e is RuntimeException)             }-            try {+            val failure = kotlin.test.assertFailsWith<Exception> {                 WeatherApi.currentTemperatures(listOf(52.0 to 13.0))-                fail("expected network failure")-            } catch (e: Exception) {-                assertTrue(true)             }+            assertNotNull(failure)         } finally {             com.vayunmathur.weather.network.WeatherApi.bundleBaseOverride = null         }
weather/src/test/java/com/vayunmathur/weather/service/WeatherMiscTest.kt
diff --git a/weather/src/test/java/com/vayunmathur/weather/service/WeatherMiscTest.kt b/weather/src/test/java/com/vayunmathur/weather/service/WeatherMiscTest.ktindex e3fe776637..40d0a00440 100644--- a/weather/src/test/java/com/vayunmathur/weather/service/WeatherMiscTest.kt+++ b/weather/src/test/java/com/vayunmathur/weather/service/WeatherMiscTest.kt@@ -84,7 +84,7 @@ class WeatherMiscTest {         val state = WeatherCarState()         var calls = 0         state.observe { calls++ }-        state.observe { throw RuntimeException("bad observer") }+        state.observe { throw IllegalStateException("bad observer") }         state.notifyChanged()         assertEquals(1, calls)         assertNull(state.forecastFor(1L))