package net.pterodactylus.sone.web import com.google.inject.Guice.createInjector import net.pterodactylus.sone.core.Core import net.pterodactylus.sone.core.FreenetInterface import net.pterodactylus.sone.main.PluginHomepage import net.pterodactylus.sone.main.PluginVersion import net.pterodactylus.sone.main.PluginYear import net.pterodactylus.sone.test.* import net.pterodactylus.sone.web.page.* import net.pterodactylus.sone.web.pages.* import net.pterodactylus.util.template.Template import org.hamcrest.Matcher import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers import org.junit.Test /** * Test for [AllPages]. */ class AllPagesTest { private val injector by lazy { baseInjector.createChildInjector( PluginVersion::class.isProvidedByMock(), PluginYear::class.isProvidedByMock(), PluginHomepage::class.isProvidedByMock() )!! } private val allPages by lazy { injector.getInstance() } private inline fun instanceOf(): Matcher = Matchers.instanceOf(T::class.java) @Test fun `about page can be injected`() { assertThat(allPages.aboutPage, instanceOf()) } @Test fun `bookmark page can be injected`() { assertThat(allPages.bookmarkPage, instanceOf()) } @Test fun `bookmarks page can be injected`() { assertThat(allPages.bookmarksPage, instanceOf()) } @Test fun `create album page can be injected`() { assertThat(allPages.createAlbumPage, instanceOf()) } @Test fun `create post page can be injected`() { assertThat(allPages.createPostPage, instanceOf()) } @Test fun `create reply page can be injected`() { assertThat(allPages.createReplyPage, instanceOf()) } @Test fun `create sone page can be injected`() { assertThat(allPages.createSonePage, instanceOf()) } @Test fun `delete album page can be injected`() { assertThat(allPages.deleteAlbumPage, instanceOf()) } @Test fun `delete image page can be injected`() { assertThat(allPages.deleteImagePage, instanceOf()) } @Test fun `delete post page can be injected`() { assertThat(allPages.deletePostPage, instanceOf()) } @Test fun `delete profile field page can be injected`() { assertThat(allPages.deleteProfileFieldPage, instanceOf()) } @Test fun `delete reply page can be injected`() { assertThat(allPages.deleteReplyPage, instanceOf()) } @Test fun `delete sone page can be injected`() { assertThat(allPages.deleteSonePage, instanceOf()) } @Test fun `dismiss notification page can be injected`() { assertThat(allPages.dismissNotificationPage, instanceOf()) } @Test fun `distrust page can be injected`() { assertThat(allPages.distrustPage, instanceOf()) } @Test fun `edit album page can be injected`() { assertThat(allPages.editAlbumPage, instanceOf()) } @Test fun `edit image page can be injected`() { assertThat(allPages.editImagePage, instanceOf()) } @Test fun `edit profile field page can be injected`() { assertThat(allPages.editProfileFieldPage, instanceOf()) } @Test fun `edit profile page can be injected`() { assertThat(allPages.editProfilePage, instanceOf()) } @Test fun `follow sone page can be injected`() { assertThat(allPages.followSonePage, instanceOf()) } @Test fun `get image page can be injected`() { assertThat(allPages.getImagePage, instanceOf()) } @Test fun `image browser page can be injected`() { assertThat(allPages.imageBrowserPage, instanceOf()) } @Test fun `index page can be injected`() { assertThat(allPages.indexPage, instanceOf()) } @Test fun `known sones page can be injected`() { assertThat(allPages.knownSonesPage, instanceOf()) } @Test fun `like page can be injected`() { assertThat(allPages.likePage, instanceOf()) } @Test fun `lock sone page can be injected`() { assertThat(allPages.lockSonePage, instanceOf()) } @Test fun `login page can be injected`() { assertThat(allPages.loginPage, instanceOf()) } @Test fun `logout page can be injected`() { assertThat(allPages.logoutPage, instanceOf()) } @Test fun `mark as known page can be injected`() { assertThat(allPages.markAsKnownPage, instanceOf()) } @Test fun `new page can be injected`() { assertThat(allPages.newPage, instanceOf()) } @Test fun `options page can be injected`() { assertThat(allPages.optionsPage, instanceOf()) } @Test fun `rescue page can be injected`() { assertThat(allPages.rescuePage, instanceOf()) } @Test fun `search page can be injected`() { assertThat(allPages.searchPage, instanceOf()) } @Test fun `trust page can be injected`() { assertThat(allPages.trustPage, instanceOf()) } @Test fun `unbookmark page can be injected`() { assertThat(allPages.unbookmarkPage, instanceOf()) } @Test fun `unfollow sone page can be injected`() { assertThat(allPages.unfollowSonePage, instanceOf()) } @Test fun `unlike page can be injected`() { assertThat(allPages.unlikePage, instanceOf()) } @Test fun `unlock sone page can be injected`() { assertThat(allPages.unlockSonePage, instanceOf()) } @Test fun `untrust page can be injected`() { assertThat(allPages.untrustPage, instanceOf()) } @Test fun `upload image page can be injected`() { assertThat(allPages.uploadImagePage, instanceOf()) } @Test fun `view post page can be injected`() { assertThat(allPages.viewPostPage, instanceOf()) } @Test fun `view sone page can be injected`() { assertThat(allPages.viewSonePage, instanceOf()) } } val baseInjector by lazy { createInjector( Core::class.isProvidedByMock(), FreenetInterface::class.isProvidedByMock(), Template::class.isProvidedByMock(), WebInterface::class.isProvidedByDeepMock(), TemplateRenderer::class.isProvidedByMock() )!! }