CORDA-2399: Samples using public TestCordapp API rather than internal one (#4521)

Also moved the contents of TestCordappUtils.kt to InternalTestUtils.kt to make it more obvious they're internal.
This commit is contained in:
Shams Asari
2019-01-08 11:55:23 +00:00
committed by GitHub
parent 8e0b2558ad
commit 8e61d11a49
10 changed files with 102 additions and 96 deletions

View File

@ -13,7 +13,7 @@ import org.junit.rules.ExpectedException;
import java.util.concurrent.Future;
import static net.corda.testing.node.internal.TestCordappsUtilsKt.cordappsForPackages;
import static net.corda.testing.node.internal.InternalTestUtilsKt.cordappsForPackages;
import static org.hamcrest.Matchers.instanceOf;
/**

View File

@ -17,12 +17,12 @@ class CustomCordappTest {
@Test
fun `packageAsJar writes out the CorDapp info into the manifest`() {
val cordapp = cordappWithPackages("net.corda.testing.node.internal").copy(targetPlatformVersion = 123, name = "TestCordappsUtilsTest")
val cordapp = cordappWithPackages("net.corda.testing.node.internal").copy(targetPlatformVersion = 123, name = "CustomCordappTest")
val jarFile = packageAsJar(cordapp)
JarInputStream(jarFile.inputStream()).use {
assertThat(it.manifest[CordappImpl.TARGET_PLATFORM_VERSION]).isEqualTo("123")
assertThat(it.manifest[CordappImpl.CORDAPP_CONTRACT_NAME]).isEqualTo("TestCordappsUtilsTest")
assertThat(it.manifest[CordappImpl.CORDAPP_WORKFLOW_NAME]).isEqualTo("TestCordappsUtilsTest")
assertThat(it.manifest[CordappImpl.CORDAPP_CONTRACT_NAME]).isEqualTo("CustomCordappTest")
assertThat(it.manifest[CordappImpl.CORDAPP_WORKFLOW_NAME]).isEqualTo("CustomCordappTest")
}
}
@ -31,7 +31,7 @@ class CustomCordappTest {
val entries = packageAsJarThenReadBack(cordappWithPackages("net.corda.testing.node.internal"))
assertThat(entries).contains(
"net/corda/testing/node/internal/TestCordappsUtilsTest.class",
"net/corda/testing/node/internal/CustomCordappTest.class",
"net/corda/testing/node/internal/resource.txt" // Make sure non-class resource files are also picked up
).doesNotContain(
"net/corda/testing/node/MockNetworkTest.class"
@ -46,7 +46,7 @@ class CustomCordappTest {
val entries = packageAsJarThenReadBack(cordappWithPackages("net.corda.testing.node"))
assertThat(entries).contains(
"net/corda/testing/node/internal/TestCordappsUtilsTest.class",
"net/corda/testing/node/internal/CustomCordappTest.class",
"net/corda/testing/node/internal/resource.txt",
"net/corda/testing/node/MockNetworkTest.class"
)

View File

@ -3,7 +3,7 @@ package net.corda.testing.node.internal
import org.assertj.core.api.Assertions.assertThat
import org.junit.Test
class TestCordappsUtilsTest {
class InternalTestUtilsTest {
@Test
fun `test simplifyScanPackages`() {
assertThat(simplifyScanPackages(emptyList())).isEmpty()