-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1875 from bugsnag/PLAT-10584_User_can_set_array_m…
…etadata_for_NDK_events NDK should report Array metadata values
- Loading branch information
Showing
4 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
bugsnag-plugin-android-ndk/src/androidTest/java/com/bugsnag/android/ndk/OpaqueValueTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.bugsnag.android.ndk | ||
|
||
import com.bugsnag.android.ndk.OpaqueValue.Companion.makeSafe | ||
import org.junit.Assert.assertEquals | ||
import org.junit.Assert.assertTrue | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.mockito.junit.MockitoJUnitRunner | ||
|
||
@RunWith(MockitoJUnitRunner::class) | ||
internal class OpaqueValueTest { | ||
|
||
@Test | ||
fun testBooleanOpaqueValue() { | ||
val result = makeSafe(true) | ||
assertEquals(true, result) | ||
val result2 = makeSafe(false) | ||
assertEquals(false, result2) | ||
} | ||
|
||
@Test | ||
fun testNumberOpaqueValue() { | ||
val result = makeSafe(1.5) | ||
assertEquals(1.5, result) | ||
} | ||
|
||
@Test | ||
fun testValidStringOpaqueValue() { | ||
val result = makeSafe("Test") | ||
assertEquals("Test", result) | ||
} | ||
|
||
@Test | ||
fun testInvalidStringOpaqueValue() { | ||
val testObject = "TestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTest" | ||
val result = makeSafe(testObject) | ||
assertTrue(result is OpaqueValue) | ||
} | ||
|
||
@Test | ||
fun testCollectionOpaqueValue() { | ||
val testObject = listOf("Test1", "Test2") | ||
val result = makeSafe(testObject) | ||
assertTrue(result is OpaqueValue) | ||
} | ||
|
||
@Test | ||
fun testMapOpaqueValue() { | ||
val testObject = mapOf(1 to "Test1") | ||
val result = makeSafe(testObject) | ||
assertTrue(result is OpaqueValue) | ||
} | ||
|
||
@Test | ||
fun testArrayOpaqueValue() { | ||
val testObject = arrayOf("Test1", "Test2") | ||
val result = makeSafe(testObject) | ||
assertTrue(result is OpaqueValue) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters