-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCryptFactorTest.kt
35 lines (29 loc) · 1.15 KB
/
CryptFactorTest.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package core
import com.kitano.crypto.internal.enums.AlgorithmType
import com.kitano.crypto.internal.CryptFactory
import com.kitano.crypto.internal.crypters.asymetric.RSACrypt
import com.kitano.crypto.internal.crypters.symetric.AESCrypt
import com.kitano.crypto.internal.crypters.symetric.DESCrypt
import kotlin.test.Test
import kotlin.test.assertTrue
class CryptFactorTest {
@Test
fun `createCrypt with algorithm type AES returns a AESCrypt instance`() {
val crypt = CryptFactory.createCrypt(AlgorithmType.AES)
assertTrue(crypt is AESCrypt)
}
@Test
fun `createCrypt with algorithm type DES returns a DESCrypt instance`() {
val crypt = CryptFactory.createCrypt(AlgorithmType.DES)
assertTrue(crypt is DESCrypt)
}
@Test
fun `createCrypt er with algorithm type RSA returns a RSACrypt instance`() {
val crypt = CryptFactory.createCrypt(AlgorithmType.RSA)
assertTrue(crypt is RSACrypt)
}
@Test(expected = IllegalArgumentException::class)
fun `createCrypt with algorithm type UNKNOWN throws IllegalArgumentException`() {
CryptFactory.createCrypt(AlgorithmType.UNKNOWN)
}
}