1package com.peachpasswords.vault23import org.junit.Assert.assertEquals4import org.junit.Assert.assertFalse5import org.junit.Test6789101112131415class ImportSettingsClassificationTest {1617 @Test18 fun every_settings_field_is_classified() {19 val declared = VaultSettings::class.java.declaredFields20 .map { it.name }21 .filterNot { it.startsWith("$") || it == "Companion" }22 .toSet()23 val classified = (IMPORT_PRESENTATION_FIELDS + IMPORT_SECURITY_POLICY_FIELDS).toSet()2425 assertEquals(26 "every VaultSettings field must be presentation-data or security-policy",27 declared,28 classified,29 )30 }3132 @Test33 fun an_imported_file_cannot_change_capture_or_consent_policy() {34 val local = VaultSettings(allowScreenshots = false, faviconsEnabled = false, faviconConsentVersion = 0)35 val hostile = VaultSettings(36 accentColor = "plum",37 allowScreenshots = true,38 faviconsEnabled = true,39 faviconConsentVersion = 1,40 )4142 val applied = applyImportedPresentationSettings(local, hostile)4344 assertEquals("presentation settings still transfer", "plum", applied.accentColor)45 assertFalse("capture protection is local policy", applied.allowScreenshots)46 assertFalse("third-party icon egress is local policy", applied.faviconsEnabled)47 assertEquals(0, applied.faviconConsentVersion)48 }49}