🔀 Merge “release/v81” into “master”
[Sone.git] / src / test / kotlin / net / pterodactylus / sone / core / PreferencesTest.kt
index 199604b..245ff03 100644 (file)
@@ -6,6 +6,7 @@ import net.pterodactylus.sone.fcp.FcpInterface.*
 import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired.*
 import net.pterodactylus.sone.fcp.event.*
 import net.pterodactylus.sone.test.*
+import net.pterodactylus.util.config.*
 import org.hamcrest.MatcherAssert.*
 import org.hamcrest.Matchers.*
 import org.junit.*
@@ -64,6 +65,13 @@ class PreferencesTest {
        }
 
        @Test
+       fun `preferences saves null for default insertion delay setting`() {
+               val configuration = Configuration(MapConfigurationBackend())
+               preferences.saveTo(configuration)
+               assertThat(configuration.getIntValue("Option/InsertionDelay").getValue(null), nullValue())
+       }
+
+       @Test
        fun `preferences retain posts per page`() {
                preferences.newPostsPerPage = 15
                assertThat(preferences.postsPerPage, equalTo(15))
@@ -180,69 +188,6 @@ class PreferencesTest {
        }
 
        @Test
-       fun `preferences retain positive trust`() {
-               preferences.newPositiveTrust = 15
-               assertThat(preferences.positiveTrust, equalTo(15))
-       }
-
-       @Test(expected = IllegalArgumentException::class)
-       fun `invalid positive trust is rejected`() {
-               preferences.newPositiveTrust = -15
-       }
-
-       @Test
-       fun `preferences return default value when positive trust is set to null`() {
-               preferences.newPositiveTrust = null
-               assertThat(preferences.positiveTrust, equalTo(75))
-       }
-
-       @Test
-       fun `preferences start with positive trust default value`() {
-               assertThat(preferences.positiveTrust, equalTo(75))
-       }
-
-       @Test
-       fun `preferences retain negative trust`() {
-               preferences.newNegativeTrust = -15
-               assertThat(preferences.negativeTrust, equalTo(-15))
-       }
-
-       @Test(expected = IllegalArgumentException::class)
-       fun `invalid negative trust is rejected`() {
-               preferences.newNegativeTrust = 150
-       }
-
-       @Test
-       fun `preferences return default value when negative trust is set to null`() {
-               preferences.newNegativeTrust = null
-               assertThat(preferences.negativeTrust, equalTo(-25))
-       }
-
-       @Test
-       fun `preferences start with negative trust default value`() {
-               assertThat(preferences.negativeTrust, equalTo(-25))
-       }
-
-       @Test
-       fun `preferences retain trust comment`() {
-               preferences.newTrustComment = "Trust"
-               assertThat(preferences.trustComment, equalTo("Trust"))
-       }
-
-       @Test
-       fun `preferences return default value when trust comment is set to null`() {
-               preferences.newTrustComment = null
-               assertThat(preferences.trustComment,
-                               equalTo("Set from Sone Web Interface"))
-       }
-
-       @Test
-       fun `preferences start with trust comment default value`() {
-               assertThat(preferences.trustComment,
-                               equalTo("Set from Sone Web Interface"))
-       }
-
-       @Test
        fun `preferences retain fcp interface active of true`() {
                preferences.newFcpInterfaceActive = true
                assertThat(preferences.fcpInterfaceActive, equalTo(true))