mardi 6 octobre 2015

Error: Caused by: java.security.InvalidKeyException at AccountLookupSpec.groovy

I'm getting the error in gradle test code. An exception is being generated on this line of code: account.setAccountNumber(encryptor.encrypt("999999999")).

I'm running Java 1.8 in IntelliJ Idea

$ gradle -version

------------------------------------------------------------
Gradle 2.3-20141027185330+0000
------------------------------------------------------------

Build time:   2014-10-27 18:53:30 UTC
Build number: none
Revision:     f8200ecfed690fe7e2183d60a2afa85069678fa3

Groovy:       2.3.6
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.8.0_05 (Oracle Corporation 25.5-b02)
OS:           Mac OS X 10.11 x86_64

$ gradle clean build

...

:test

com.distributedfinance.mbi.bai.lookup.AccountLookupSpec > constructor missing encryptor                                                                        FAILED
    java.lang.IllegalArgumentException at AccountLookupSpec.groovy:26
        Caused by: java.security.InvalidKeyException at AccountLookupSpec.groovy:26

The exception is in Groovy code:

 AccountLookup accountLookup
    List<Account> accounts
    AccountRepository accountRepository
    TextEncryptor encryptor

    def setup() {
        accountRepository = Mock()

 encryptor = Encryptors.text("password", "blahblahbla")
 ***account.setAccountNumber(encryptor.encrypt("999999999"))***

...

def "constructor missing encryptor"() {
        when:
        new AccountLookup(null, accountRepository)

        then:
        IllegalArgumentException e = thrown()
        e.getMessage() == "Encryptor is null"
    }

Any ideas?

Aucun commentaire:

Enregistrer un commentaire