Fix kotlin tests, remove unused code (#32880)

* Fix kotlin tests, remove unused code

assertThat(false) doesn't actually do anythung, it returns an object
you can then make assertions against, use assertTrue instead

testQRCodeWithOptionalData relied upon an implicit ordering, however
the underlying representation (HashMap) is unordered

* re-add line with unused val

* Revert val unused =
diff --git a/src/controller/java/src/matter/onboardingpayload/QRCodeBasicOnboardingPayloadGenerator.kt b/src/controller/java/src/matter/onboardingpayload/QRCodeBasicOnboardingPayloadGenerator.kt
index 853b330..49befbd 100644
--- a/src/controller/java/src/matter/onboardingpayload/QRCodeBasicOnboardingPayloadGenerator.kt
+++ b/src/controller/java/src/matter/onboardingpayload/QRCodeBasicOnboardingPayloadGenerator.kt
@@ -68,9 +68,6 @@
 
     // Copy the subBuffer back to the outBuffer
     subBuffer.copyInto(outBuffer, prefixLen)
-
-    // Reduce output buffer size to be the size of written data
-    outBuffer.copyOf(prefixLen + subBuffer.size)
   }
 }
 
diff --git a/src/controller/java/tests/matter/onboardingpayload/ManualCodeTest.kt b/src/controller/java/tests/matter/onboardingpayload/ManualCodeTest.kt
index 900a3eb..42e60e7 100644
--- a/src/controller/java/tests/matter/onboardingpayload/ManualCodeTest.kt
+++ b/src/controller/java/tests/matter/onboardingpayload/ManualCodeTest.kt
@@ -24,6 +24,7 @@
 import kotlin.math.log10
 import kotlin.math.pow
 import org.junit.Assert.assertEquals
+import org.junit.Assert.assertTrue
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.junit.runners.JUnit4
@@ -444,7 +445,7 @@
     // Override the discriminator in the input payload with the short version,
     // since that's what we will produce.
     inPayload.setShortDiscriminatorValue(inPayload.getShortDiscriminatorValue())
-    assertThat(inPayload == outPayload)
+    assertEquals(inPayload, outPayload)
   }
 
   /*
@@ -464,7 +465,7 @@
     // Override the discriminator in the input payload with the short version,
     // since that's what we will produce.
     inPayload.setShortDiscriminatorValue(inPayload.getShortDiscriminatorValue())
-    assertThat(inPayload == outPayload)
+    assertEquals(inPayload, outPayload)
   }
 
   /*
@@ -479,7 +480,7 @@
 
     try {
       ManualOnboardingPayloadParser.checkDecimalStringValidity(representationWithoutCheckDigit)
-      assertThat(false)
+      assertTrue(false)
     } catch (e: Exception) {
       println("Expected exception occurred: ${e.message}")
     }
@@ -487,7 +488,7 @@
     representationWithoutCheckDigit = "1"
     try {
       ManualOnboardingPayloadParser.checkDecimalStringValidity(representationWithoutCheckDigit)
-      assertThat(false)
+      assertTrue(false)
     } catch (e: Exception) {
       println("Expected exception occurred: ${e.message}")
     }
@@ -516,28 +517,28 @@
 
     try {
       ManualOnboardingPayloadParser.checkCodeLengthValidity("01234567891", false)
-      assertThat(false)
+      assertTrue(false)
     } catch (e: Exception) {
       println("Expected exception occurred: ${e.message}")
     }
 
     try {
       ManualOnboardingPayloadParser.checkCodeLengthValidity("012345678", false)
-      assertThat(false)
+      assertTrue(false)
     } catch (e: Exception) {
       println("Expected exception occurred: ${e.message}")
     }
 
     try {
       ManualOnboardingPayloadParser.checkCodeLengthValidity("012345678901234567891", true)
-      assertThat(false)
+      assertTrue(false)
     } catch (e: Exception) {
       println("Expected exception occurred: ${e.message}")
     }
 
     try {
       ManualOnboardingPayloadParser.checkCodeLengthValidity("0123456789012345678", true)
-      assertThat(false)
+      assertTrue(false)
     } catch (e: Exception) {
       println("Expected exception occurred: ${e.message}")
     }
@@ -562,14 +563,14 @@
 
     try {
       ManualOnboardingPayloadParser.toNumber("012345.123456789")
-      assertThat(false)
+      assertTrue(false)
     } catch (e: Exception) {
       println("Expected exception occurred: ${e.message}")
     }
 
     try {
       ManualOnboardingPayloadParser.toNumber("/")
-      assertThat(false)
+      assertTrue(false)
     } catch (e: Exception) {
       println("Expected exception occurred: ${e.message}")
     }
@@ -631,14 +632,14 @@
     try {
       index.set(1)
       ManualOnboardingPayloadParser.readDigitsFromDecimalString("12345", index, 5)
-      assertThat(false)
+      assertTrue(false)
     } catch (e: Exception) {
       println("Expected exception occurred: ${e.message}")
     }
 
     try {
       ManualOnboardingPayloadParser.readDigitsFromDecimalString("12", index, 5)
-      assertThat(false)
+      assertTrue(false)
     } catch (e: Exception) {
       println("Expected exception occurred: ${e.message}")
     }
@@ -646,7 +647,7 @@
     try {
       index.set(200)
       ManualOnboardingPayloadParser.readDigitsFromDecimalString("6256276377282", index, 1)
-      assertThat(false)
+      assertTrue(false)
     } catch (e: Exception) {
       println("Expected exception occurred: ${e.message}")
     }
diff --git a/src/controller/java/tests/matter/onboardingpayload/QRCodeTest.kt b/src/controller/java/tests/matter/onboardingpayload/QRCodeTest.kt
index 62dff45..4cc9477 100644
--- a/src/controller/java/tests/matter/onboardingpayload/QRCodeTest.kt
+++ b/src/controller/java/tests/matter/onboardingpayload/QRCodeTest.kt
@@ -20,6 +20,7 @@
 
 import com.google.common.truth.Truth.assertThat
 import org.junit.Assert.assertEquals
+import org.junit.Assert.assertTrue
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.junit.runners.JUnit4
@@ -224,7 +225,7 @@
 
     try {
       QRCodeOnboardingPayloadParser(invalidString).populatePayload()
-      assertThat(false)
+      assertTrue(false)
     } catch (e: Exception) {
       println("Expected exception occurred: ${e.message}")
     }
@@ -240,7 +241,7 @@
 
     try {
       QRCodeOnboardingPayloadParser(invalidString).populatePayload()
-      assertThat(false)
+      assertTrue(false)
     } catch (e: Exception) {
       println("Expected exception occurred: ${e.message}")
     }
@@ -396,21 +397,21 @@
     // verify we can grab just the serial number as well
     assertThat(parsedQrCode.getSerialNumber()).isEqualTo("123456789")
 
-    // Test 2nd optional field
-    optionalQRCodeInfo = OptionalQRCodeInfoExtension()
-    optionalQRCodeInfo.tag = 130
-    optionalQRCodeInfo.type = OptionalQRCodeInfoType.TYPE_STRING
-    optionalQRCodeInfo.data = "myData"
+    val optionalQRCodeInfo1 = OptionalQRCodeInfoExtension()
+    optionalQRCodeInfo1.tag = 130
+    optionalQRCodeInfo1.type = OptionalQRCodeInfoType.TYPE_STRING
+    optionalQRCodeInfo1.data = "myData"
 
-    assertThat(parsedQrCode.getAllOptionalVendorData()[0]).isEqualTo(optionalQRCodeInfo)
+    val optionalQRCodeInfo2 = OptionalQRCodeInfoExtension()
+    optionalQRCodeInfo2.tag = 131
+    optionalQRCodeInfo2.type = OptionalQRCodeInfoType.TYPE_INT32
+    optionalQRCodeInfo2.int32 = 12
 
-    // Test 3rd optional field
-    optionalQRCodeInfo = OptionalQRCodeInfoExtension()
-    optionalQRCodeInfo.tag = 131
-    optionalQRCodeInfo.type = OptionalQRCodeInfoType.TYPE_INT32
-    optionalQRCodeInfo.int32 = 12
+    val vendor1 = parsedQrCode.getAllOptionalVendorData()[0]
+    val vendor2 = parsedQrCode.getAllOptionalVendorData()[1]
 
-    assertThat(parsedQrCode.getAllOptionalVendorData()[1]).isEqualTo(optionalQRCodeInfo)
+    assertTrue(vendor1 == optionalQRCodeInfo1 || vendor1 == optionalQRCodeInfo2)
+    assertTrue(vendor2 == optionalQRCodeInfo1 || vendor2 == optionalQRCodeInfo2)
   }
 
   companion object {