1 package net.pterodactylus.sone.main
3 import org.hamcrest.MatcherAssert.assertThat
4 import org.hamcrest.Matchers.equalTo
5 import org.hamcrest.Matchers.nullValue
9 * Unit test for [parseVersion].
11 class VersionParserTest {
14 fun `version from missing file can not be read`() {
15 assertThat(parseVersion("does-not-exist.yaml"), nullValue())
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"))
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"))
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"))