✨ Annotate BookmarksPage with MenuName
[Sone.git] / src / test / kotlin / net / pterodactylus / sone / main / VersionParserTest.kt
1 package net.pterodactylus.sone.main
2
3 import org.hamcrest.MatcherAssert.assertThat
4 import org.hamcrest.Matchers.equalTo
5 import org.hamcrest.Matchers.nullValue
6 import org.junit.Test
7
8 /**
9  * Unit test for [parseVersion].
10  */
11 class VersionParserTest {
12
13         @Test
14         fun `version from missing file can not be read`() {
15                 assertThat(parseVersion("does-not-exist.yaml"), nullValue())
16         }
17
18         @Test
19         fun `custom version file can be parsed`() {
20                 val version = parseVersion("custom-version.yaml")!!
21                 assertThat(version.id, equalTo("some-id"))
22                 assertThat(version.nice, equalTo("some-nice"))
23         }
24
25         @Test
26         fun `default version file is parsed`() {
27                 val version = parseVersion()!!
28                 assertThat(version.id, equalTo("43f3e1c3a0f487e37e5851a2cc72756d271c7571"))
29                 assertThat(version.nice, equalTo("0.9.6-466-g43f3e1c"))
30         }
31
32         @Test
33         fun `parsed version is created correctly`() {
34                 val version = parsedVersion!!
35                 assertThat(version.id, equalTo("43f3e1c3a0f487e37e5851a2cc72756d271c7571"))
36                 assertThat(version.nice, equalTo("0.9.6-466-g43f3e1c"))
37         }
38
39 }