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