import com.google.inject.matcher.*
import com.google.inject.name.Names.*
import com.google.inject.spi.*
+import freenet.l10n.*
import net.pterodactylus.sone.database.*
import net.pterodactylus.sone.database.memory.*
import net.pterodactylus.sone.freenet.wot.*
bind(PluginYear::class.java).toInstance(PluginYear(sonePlugin.year))
bind(PluginHomepage::class.java).toInstance(PluginHomepage(sonePlugin.homepage))
bind(Database::class.java).to(MemoryDatabase::class.java).`in`(Singleton::class.java)
+ bind(BaseL10n::class.java).toInstance(sonePlugin.l10n().base)
loaders?.let { bind(Loaders::class.java).toInstance(it) }
bindListener(Matchers.any(), object : TypeListener {
import com.google.common.eventbus.*
import com.google.inject.Guice.*
import com.google.inject.name.Names.*
+import freenet.l10n.*
import net.pterodactylus.sone.database.*
import net.pterodactylus.sone.database.memory.*
import net.pterodactylus.sone.freenet.wot.*
import net.pterodactylus.util.version.Version
import org.hamcrest.MatcherAssert.*
import org.hamcrest.Matchers.*
-import org.junit.*
import java.io.*
import java.util.concurrent.atomic.*
+import kotlin.test.*
const val versionString = "v80"
private val pluginVersion = Version("", 80)
private val pluginYear = 2019
private val pluginHomepage = "home://page"
+ private val l10n = deepMock<PluginL10n>()
private val sonePlugin = mock<SonePlugin>().apply {
whenever(version).thenReturn(versionString)
whenever(year).thenReturn(pluginYear)
whenever(homepage).thenReturn(pluginHomepage)
+ whenever(l10n()).thenReturn(l10n)
}
private val injector by lazy { createInjector(SoneModule(sonePlugin)) }
- @After
+ @AfterTest
fun removePropertiesFromCurrentDirectory() {
File(currentDir, "sone.properties").delete()
}
}
@Test
+ fun `base l10n is bound correctly`() {
+ assertThat(injector.getInstance(), sameInstance(l10n.base))
+ }
+
+ @Test
fun `default loader is used without dev options`() {
assertThat(injector.getInstance<Loaders>(), instanceOf(DefaultLoaders::class.java))
}