Fixed JUnit to not use a deprecated/removed JDK package "com.sun.xml.internal.messaging.saaj".

This commit is contained in:
josecoll 2019-05-14 18:31:53 +01:00
parent c8eb13efe2
commit 4db2447e0b

View File

@ -4,7 +4,6 @@ import com.nhaarman.mockito_kotlin.any
import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.times
import com.nhaarman.mockito_kotlin.verify
import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream
import net.corda.core.crypto.SecureHash
import net.corda.core.internal.SignedDataWithCert
import net.corda.core.node.NetworkParameters
@ -26,6 +25,7 @@ import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import java.io.ByteArrayOutputStream
import java.io.PrintStream
import kotlin.streams.toList
@ -100,6 +100,7 @@ class DBNetworkParametersStorageTest {
database.transaction {
val consoleOutput = interceptConsoleOutput {
networkParametersService.lookup(hash3)
System.out.println()
}
assertThat(consoleOutput).anySatisfy {
it.contains("Caused by: java.security.cert.CertPathValidatorException: subject/issuer name chaining check failed")
@ -109,11 +110,11 @@ class DBNetworkParametersStorageTest {
private fun interceptConsoleOutput(block: () -> Unit): List<String> {
val oldOut = System.out
val out = ByteOutputStream()
val out = ByteArrayOutputStream()
System.setOut(PrintStream(out))
block()
System.setOut(oldOut)
return out.bytes.inputStream().bufferedReader().lines().toList()
return out.toByteArray().inputStream().bufferedReader().lines().toList()
}
private fun createMockNetworkMapClient(): NetworkMapClient {