Store updated Sone in database
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 24 Feb 2019 08:20:52 +0000 (09:20 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 24 Feb 2019 08:20:52 +0000 (09:20 +0100)
src/main/kotlin/net/pterodactylus/sone/core/UpdatedSoneProcessor.kt
src/test/kotlin/net/pterodactylus/sone/core/UpdatedSoneProcessorTest.kt

index ebaa3c8..28bac6d 100644 (file)
@@ -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
index e7afc74..9e7c71e 100644 (file)
@@ -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()