File tree Expand file tree Collapse file tree
main/java/com/owncloud/android/lib/resources/status
test/java/com/owncloud/android/lib/resources/status Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/*
22 * Nextcloud Android Library
33 *
4- * SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
4+ * SPDX-FileCopyrightText: 2023-2026 Nextcloud GmbH and Nextcloud contributors
5+ * SPDX-FileCopyrightText: 2026 Alper Ozturk <alper.ozturk@nextcloud.com>
56 * SPDX-FileCopyrightText: 2023 Tobias Kaminsky <tobias@kaminsky.me>
67 * SPDX-License-Identifier: MIT
78 */
@@ -19,10 +20,14 @@ enum class E2EVersion(
1920
2021 val value: String = values.last()
2122
23+ var unknownValue: String? = null
24+
2225 companion object {
2326 fun max (): E2EVersion = V2_1
2427
2528 @JvmStatic
26- fun fromValue (v : String? ): E2EVersion = entries.find { v in it.values } ? : UNKNOWN
29+ fun fromValue (v : String? ): E2EVersion =
30+ entries.find { v in it.values }
31+ ? : UNKNOWN .also { it.unknownValue = v }
2732 }
2833}
Original file line number Diff line number Diff line change @@ -60,6 +60,13 @@ class E2EVersionTests {
6060 assertEquals(E2EVersion .UNKNOWN , E2EVersion .fromValue(null ))
6161 }
6262
63+ @Test
64+ fun testFromValueWhenGiven3Dot0ShouldReturnTrue () {
65+ val version = E2EVersion .fromValue(" 3.0" )
66+ assertEquals(E2EVersion .UNKNOWN , version)
67+ assertEquals(" 3.0" , version.unknownValue)
68+ }
69+
6370 @Test
6471 fun testValues () {
6572 assertEquals(E2EVersion .V1_0 .value, " 1.0" )
You can’t perform that action at this time.
0 commit comments