From: David ‘Bombe’ Roden Date: Sun, 24 Feb 2019 08:20:52 +0000 (+0100) Subject: Store updated Sone in database X-Git-Tag: v79^2~94 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=835c41cac521d1a988404f8711469c136b7a1764;p=Sone.git Store updated Sone in database --- diff --git a/src/main/kotlin/net/pterodactylus/sone/core/UpdatedSoneProcessor.kt b/src/main/kotlin/net/pterodactylus/sone/core/UpdatedSoneProcessor.kt index ebaa3c8..28bac6d 100644 --- a/src/main/kotlin/net/pterodactylus/sone/core/UpdatedSoneProcessor.kt +++ b/src/main/kotlin/net/pterodactylus/sone/core/UpdatedSoneProcessor.kt @@ -49,6 +49,7 @@ abstract class BasicUpdateSoneProcessor(private val database: Database, private .map { PostReplyRemovedEvent(it) } .forEach(eventBus::post) } + database.storeSone(sone) sone.options = storedSone.options sone.isKnown = storedSone.isKnown sone.status = if (sone.time != 0L) SoneStatus.idle else SoneStatus.unknown diff --git a/src/test/kotlin/net/pterodactylus/sone/core/UpdatedSoneProcessorTest.kt b/src/test/kotlin/net/pterodactylus/sone/core/UpdatedSoneProcessorTest.kt index e7afc74..9e7c71e 100644 --- a/src/test/kotlin/net/pterodactylus/sone/core/UpdatedSoneProcessorTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/core/UpdatedSoneProcessorTest.kt @@ -142,6 +142,12 @@ class UpdatedSoneProcessorTest { } @Test + fun `updated sone processor stores sone in database`() { + updatedSoneProcessor.updateSone(newSone) + verify(database).storeSone(newSone) + } + + @Test fun `default updated Sone processor can be created by dependency injection`() { assertThat(baseInjector.createChildInjector( Database::class.isProvidedByMock()