Merge branch 'release-0.9.6'
[Sone.git] / src / test / java / net / pterodactylus / sone / web / AboutPageTest.java
1 package net.pterodactylus.sone.web;
2
3 import static org.hamcrest.MatcherAssert.assertThat;
4 import static org.hamcrest.Matchers.is;
5
6 import org.junit.Test;
7
8 /**
9  * Unit test for {@link AboutPage}.
10  *
11  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
12  */
13 public class AboutPageTest extends WebPageTest {
14
15         private final String version = "0.1.2";
16         private final int year = 1234;
17         private final String homepage = "home://page";
18         private final AboutPage page = new AboutPage(template, webInterface, version, year, homepage);
19
20         @Test
21         public void pageReturnsCorrectPath() {
22                 assertThat(page.getPath(), is("about.html"));
23         }
24
25         @Test
26         public void pageSetsCorrectVersionInTemplateContext() throws Exception {
27                 page.processTemplate(freenetRequest, templateContext);
28                 assertThat(templateContext.get("version"), is((Object) version));
29         }
30
31         @Test
32         public void pageSetsCorrectHomepageInTemplateContext() throws Exception {
33                 page.processTemplate(freenetRequest, templateContext);
34                 assertThat(templateContext.get("homepage"), is((Object) homepage));
35         }
36
37         @Test
38         public void pageSetsCorrectYearInTemplateContext() throws Exception {
39                 page.processTemplate(freenetRequest, templateContext);
40                 assertThat(templateContext.get("year"), is((Object) year));
41         }
42
43 }