Merged in corpriv-699 (pull request #24)

CORPRIV-699: Use platform-specific separator.

Approved-by: Shams Asari
This commit is contained in:
Chris Rankin 2017-03-02 09:03:14 +00:00
commit 39dacac330

View File

@ -1,20 +1,24 @@
package com.r3.corda.doorman
import org.junit.Test
import java.io.File
import kotlin.test.assertEquals
import kotlin.test.assertTrue
class DoormanParametersTest {
private val testDummyPath = ".${File.separator}testDummyPath.jks"
@Test
fun `parse arg correctly`() {
val params = DoormanParameters(arrayOf("--keygen", "--keystorePath", "./testDummyPath.jks"))
val params = DoormanParameters(arrayOf("--keygen", "--keystorePath", testDummyPath))
assertEquals(DoormanParameters.Mode.CA_KEYGEN, params.mode)
assertEquals("./testDummyPath.jks", params.keystorePath.toString())
assertEquals(testDummyPath, params.keystorePath.toString())
assertEquals(0, params.port)
val params2 = DoormanParameters(arrayOf("--keystorePath", "./testDummyPath.jks", "--port", "1000"))
val params2 = DoormanParameters(arrayOf("--keystorePath", testDummyPath, "--port", "1000"))
assertEquals(DoormanParameters.Mode.DOORMAN, params2.mode)
assertEquals("./testDummyPath.jks", params2.keystorePath.toString())
assertEquals(testDummyPath, params2.keystorePath.toString())
assertEquals(1000, params2.port)
}
}