libcvrapi/src/test/groovy/biz/nellemann/libcvrapi/CvrApiSpec.groovy

33 lines
696 B
Groovy
Raw Normal View History

2019-08-17 17:53:11 +00:00
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'
2019-08-19 08:00:01 +00:00
company.secondarynames.contains('Wavetech A/S')
2019-08-17 17:53:11 +00:00
}
}