import net.pterodactylus.util.template.TemplateContext
import java.util.logging.Level
import java.util.logging.Logger
+import javax.inject.Inject
/**
* The “create Sone” page lets the user create a new Sone.
*/
-class CreateSonePage(template: Template, webInterface: WebInterface):
+class CreateSonePage @Inject constructor(template: Template, webInterface: WebInterface):
SoneTemplatePage("createSone.html", webInterface, template, "Page.CreateSone.Title") {
private val logger = Logger.getLogger(CreateSonePage::class.java.name)
import net.pterodactylus.sone.data.Profile
import net.pterodactylus.sone.data.Sone
import net.pterodactylus.sone.freenet.wot.OwnIdentity
+import net.pterodactylus.sone.test.getInstance
import net.pterodactylus.sone.test.mock
import net.pterodactylus.sone.test.whenever
+import net.pterodactylus.sone.web.baseInjector
import net.pterodactylus.util.web.Method.POST
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.contains
import org.hamcrest.Matchers.equalTo
+import org.hamcrest.Matchers.notNullValue
import org.junit.Test
import org.mockito.ArgumentMatchers.anyString
import org.mockito.Mockito.verify
assertThat(page.isEnabled(toadletContext), equalTo(true))
}
+ @Test
+ fun `page can be created by dependency injection`() {
+ assertThat(baseInjector.getInstance<CreateSonePage>(), notNullValue())
+ }
+
}