32 lines
640 B
Groovy
32 lines
640 B
Groovy
package biz.nellemann.libcvrapi
|
|
|
|
import spock.lang.Specification
|
|
|
|
class CvrApiSpec extends Specification {
|
|
|
|
CvrApi api
|
|
File testFile
|
|
String testJson
|
|
|
|
def setup() {
|
|
api = new CvrApi("Test User Agent", "testAuthToken")
|
|
testFile = new File(getClass().getResource('/company.json').toURI())
|
|
testJson = testFile.getText('UTF-8')
|
|
}
|
|
|
|
def cleanup() { }
|
|
|
|
void "test we can parse a company"() {
|
|
|
|
when:
|
|
def company = api.parseJsonIntoCompany(testJson)
|
|
|
|
then:
|
|
company != null
|
|
company.vat == 25063864
|
|
company.life.name == 'AGILLIC A/S'
|
|
}
|
|
|
|
}
|
|
|