fix: add explicit : Unit return type to @Test functions using runBlocking

JUnit4's BlockJUnit4ClassRunner requires @Test methods to compile with a
void return type. 'fun test() = runBlocking { ... }' infers the function's
return type from the block's last expression - two of these tests ended
on a Mockito verify(...).someMethod(...) call, whose return type leaks
through as the inferred type (e.g. String, since TronGridApi.broadcastTransaction
returns String) instead of Unit, so the whole test class failed
ParentRunner validation before any test could even run. Declaring the
return type explicitly as Unit makes Kotlin discard the expression's
value (unit-coercion) rather than infer it - added to all three tests for
consistency, not just the two that were actually failing.
This commit is contained in:
2026-07-10 09:05:03 -07:00
parent c5c04807d4
commit fb1e0c9cf0
@@ -97,7 +97,7 @@ class RealTronTransactionServiceTest {
}
@Test
fun `transact with Native intent should build, sign with sha256(raw_data), and broadcast a 65-byte r+s+v signature`() = runBlocking {
fun `transact with Native intent should build, sign with sha256(raw_data), and broadcast a 65-byte r+s+v signature`(): Unit = runBlocking {
val unsigned = TronUnsignedTransactionResponse(
visible = false,
txID = expectedTxId,
@@ -147,7 +147,7 @@ class RealTronTransactionServiceTest {
}
@Test
fun `transact should refuse to sign when TronGrid's txID does not match sha256(raw_data)`() = runBlocking {
fun `transact should refuse to sign when TronGrid's txID does not match sha256(raw_data)`(): Unit = runBlocking {
val tamperedTxId = "0".repeat(64) // deliberately wrong - does not match sha256(rawDataHex)
val unsigned = TronUnsignedTransactionResponse(
visible = false,
@@ -175,7 +175,7 @@ class RealTronTransactionServiceTest {
}
@Test
fun `calculateFee for Native intent should charge bandwidth shortfall at the fallback price when TronGrid's own resource_endpoints are unavailable`() = runBlocking {
fun `calculateFee for Native intent should charge bandwidth shortfall at the fallback price when TronGrid's own resource_endpoints are unavailable`(): Unit = runBlocking {
val unsigned = TronUnsignedTransactionResponse(
visible = false,
txID = expectedTxId,