Switch to JUnit 5
This commit is contained in:
parent
6c869a47df
commit
b688013f16
|
@ -122,10 +122,14 @@ dependencies {
|
|||
implementation 'javax.annotation:javax.annotation-api:1.2'
|
||||
|
||||
// Tests
|
||||
testImplementation "junit:junit:4.12"
|
||||
testImplementation 'org.mockito:mockito-junit-jupiter:2.23.0'
|
||||
testImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.0.0'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.2'
|
||||
androidTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.2'
|
||||
androidTestImplementation "androidx.test:runner:1.1.1"
|
||||
androidTestImplementation "androidx.test.espresso:espresso-core:3.1.1"
|
||||
androidTestImplementation "androidx.test:core:1.1.0"
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
|
||||
androidTestImplementation "androidx.arch.core:core-testing:${versions.architectureComponents}"
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.junit.Rule
|
|||
import org.junit.Test
|
||||
import rpc.CompactFormats
|
||||
|
||||
class CompactBlockDownloaderTest {
|
||||
class CompactBlockDownloaderTestAndroid {
|
||||
@get:Rule
|
||||
var instantTaskExecutorRule = InstantTaskExecutorRule()
|
||||
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
package cash.z.wallet.sdk;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
|
@ -1,18 +1,15 @@
|
|||
package cash.z.wallet.sdk
|
||||
|
||||
|
||||
import android.util.Log
|
||||
import io.grpc.ManagedChannel
|
||||
import io.grpc.ManagedChannelBuilder
|
||||
import org.junit.AfterClass
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.BeforeClass
|
||||
import org.junit.Test
|
||||
import org.junit.jupiter.api.*
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Assertions.assertNotNull
|
||||
import rpc.CompactTxStreamerGrpc
|
||||
import rpc.Service
|
||||
import rpc.Service.*
|
||||
import rpc.WalletDataOuterClass
|
||||
import rpc.Service.BlockID
|
||||
import rpc.Service.BlockRange
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class GlueTest {
|
||||
|
@ -37,14 +34,14 @@ class GlueTest {
|
|||
companion object {
|
||||
lateinit var blockingStub: CompactTxStreamerGrpc.CompactTxStreamerBlockingStub
|
||||
|
||||
@BeforeClass
|
||||
@BeforeAll
|
||||
@JvmStatic
|
||||
fun setup() {
|
||||
val channel = ManagedChannelBuilder.forAddress("localhost", 9067).usePlaintext().build()
|
||||
blockingStub = CompactTxStreamerGrpc.newBlockingStub(channel)
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@AfterAll
|
||||
@JvmStatic
|
||||
fun tearDown() {
|
||||
(blockingStub.channel as ManagedChannel).shutdown().awaitTermination(2000L, TimeUnit.MILLISECONDS)
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
package cash.z.wallet.sdk
|
||||
|
||||
|
||||
import android.util.Log
|
||||
import io.grpc.ManagedChannel
|
||||
import io.grpc.ManagedChannelBuilder
|
||||
import org.junit.AfterClass
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.BeforeClass
|
||||
import org.junit.Test
|
||||
import org.junit.jupiter.api.AfterAll
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Assertions.assertNotNull
|
||||
import org.junit.jupiter.api.BeforeAll
|
||||
import org.junit.jupiter.api.Test
|
||||
import rpc.CompactTxStreamerGrpc
|
||||
import rpc.Service
|
||||
import rpc.Service.*
|
||||
|
@ -52,14 +51,14 @@ class GrpcTest {
|
|||
companion object {
|
||||
lateinit var blockingStub: CompactTxStreamerGrpc.CompactTxStreamerBlockingStub
|
||||
|
||||
@BeforeClass
|
||||
@BeforeAll
|
||||
@JvmStatic
|
||||
fun setup() {
|
||||
val channel = ManagedChannelBuilder.forAddress("localhost", 9067).usePlaintext().build()
|
||||
blockingStub = CompactTxStreamerGrpc.newBlockingStub(channel)
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@AfterAll
|
||||
@JvmStatic
|
||||
fun tearDown() {
|
||||
(blockingStub.channel as ManagedChannel).shutdown().awaitTermination(2000L, TimeUnit.MILLISECONDS)
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package cash.z.wallet.sdk.data
|
||||
|
||||
import org.junit.jupiter.api.Assertions.*
|
||||
import java.util.function.Supplier
|
||||
|
||||
class CompactBlockDownloaderTest {
|
||||
|
||||
@org.junit.jupiter.api.BeforeEach
|
||||
fun setUp() {
|
||||
}
|
||||
|
||||
@org.junit.jupiter.api.AfterEach
|
||||
fun tearDown() {
|
||||
}
|
||||
|
||||
private val supplier: Supplier<String> = Supplier { "failure is a virtue" }
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
fun blocks() {
|
||||
assertEquals(5, 4+1, supplier)
|
||||
}
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
fun start() {
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue