+ @Test
+ fun `first-start event is sent to event bus when first start is true`() {
+ File("sone.properties").delete()
+ val firstStartReceived = AtomicBoolean()
+ runSonePluginWithRealInjector {
+ val eventBus = it.getInstance(EventBus::class.java)
+ eventBus.register(object : Any() {
+ @Subscribe
+ fun firstStart(firstStart: FirstStart) {
+ firstStartReceived.set(true)
+ }
+ })
+ }
+ sonePlugin.runPlugin(pluginRespirator)
+ assertThat(firstStartReceived.get(), equalTo(true))
+ }
+
+ @Test
+ fun `first-start event is not sent to event bus when first start is false`() {
+ File("sone.properties").deleteAfter {
+ writeText("# empty")
+ val firstStartReceived = AtomicBoolean()
+ runSonePluginWithRealInjector {
+ val eventBus = it.getInstance(EventBus::class.java)
+ eventBus.register(object : Any() {
+ @Subscribe
+ fun firstStart(firstStart: FirstStart) {
+ firstStartReceived.set(true)
+ }
+ })
+ }
+ sonePlugin.runPlugin(pluginRespirator)
+ assertThat(firstStartReceived.get(), equalTo(false))
+ }
+ }
+