From: David ‘Bombe’ Roden Date: Sat, 27 Jul 2019 09:17:07 +0000 (+0200) Subject: ✅ Add test for unsuccessful parsing not adding data to duration histogram X-Git-Tag: v81^2~177 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=9e0d93ff9db1ba35f437cc168378f03bdae37e86;p=Sone.git ✅ Add test for unsuccessful parsing not adding data to duration histogram --- diff --git a/src/test/kotlin/net/pterodactylus/sone/core/SoneParserTest.kt b/src/test/kotlin/net/pterodactylus/sone/core/SoneParserTest.kt index 0648d1f..6d9d4b8 100644 --- a/src/test/kotlin/net/pterodactylus/sone/core/SoneParserTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/core/SoneParserTest.kt @@ -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())