✅ Add test for unsuccessful parsing not adding data to duration histogram
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 27 Jul 2019 09:17:07 +0000 (11:17 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 27 Jul 2019 09:17:07 +0000 (11:17 +0200)
src/test/kotlin/net/pterodactylus/sone/core/SoneParserTest.kt

index 0648d1f..6d9d4b8 100644 (file)
@@ -398,6 +398,14 @@ class SoneParserTest {
        }
 
        @Test
+       fun `unsuccessful parsing does not add a histogram entry`() {
+               val inputStream = javaClass.getResourceAsStream("sone-parser-with-invalid-image-height.xml")
+               assertThat(soneParser.parseSone(sone, inputStream), nullValue())
+               val histogram = metricRegistry.histogram("sone.parsing.duration")
+               assertThat(histogram.count, equalTo(0L))
+       }
+
+       @Test
        fun `successful parsing adds histogram entry`() {
                val inputStream = javaClass.getResourceAsStream("sone-parser-without-images.xml")
                assertThat(soneParser.parseSone(sone, inputStream), notNullValue())