doAnswer {
soneInserter.stop()
null
- }.`when`(core).touchConfiguration()
+ }.whenever(core).touchConfiguration()
soneInserter.serviceRun()
val soneEvents = ArgumentCaptor.forClass(SoneEvent::class.java)
verify(freenetInterface).insertDirectory(eq(insertUri), any<HashMap<String, Any>>(), eq("index.html"))
doAnswer {
soneInserter.stop()
null
- }.`when`(core).touchConfiguration()
+ }.whenever(core).touchConfiguration()
soneInserter.serviceRun()
val histogram = metricRegistry.histogram("sone.insert.duration")
assertThat(histogram.count, equalTo(1L))
}
@Test
- fun `unsuccessful insert does not update metrics`() {
+ fun `unsuccessful insert does not update histogram but records error`() {
val insertUri = mock<FreenetURI>()
createSone(insertUri)
val soneModificationDetector = mock<SoneModificationDetector>()
soneInserter.serviceRun()
val histogram = metricRegistry.histogram("sone.insert.duration")
assertThat(histogram.count, equalTo(0L))
+ val meter = metricRegistry.meter("sone.insert.errors")
+ assertThat(meter.count, equalTo(1L))
}
}