Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

Commit

Permalink
Fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fmbenhassine committed Jan 30, 2019
1 parent 7e9cd07 commit 422c233
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ allprojects {
sqlfireclientVersion = '1.0.3'
sqliteVersion = '3.25.2'
woodstoxVersion = '5.2.0'
xercesVersion = '2.12.0' //?
xmlunitVersion = '2.6.2'
xstreamVersion = '1.4.11.1'
jrubyVersion = '1.7.27'
Expand Down Expand Up @@ -455,7 +454,6 @@ project('spring-batch-infrastructure-tests') {
testCompile "org.xmlunit:xmlunit-matchers:$xmlunitVersion"
testCompile "org.apache.logging.log4j:log4j-api:$log4jVersion"
testCompile "org.apache.logging.log4j:log4j-core:$log4jVersion"
testCompile "xerces:xercesImpl:$xercesVersion"
testCompile "com.thoughtworks.xstream:xstream:$xstreamVersion"
testCompile("com.fasterxml.woodstox:woodstox-core:$woodstoxVersion") {
exclude group: 'stax', module: 'stax-api'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ dn: cn=Gern Jensen,ou=Product Testing,dc=airius,dc=com
telephonenumber: +1 408 555 1212
uid: gernj
description:: V2hhdCBhIGNhcmVmdWwgcmVhZGVyIHlvdSBhcmUhICBUaGlzIHZhbHVlIGlzIGJhc2UtNjQtZW5j
b2RlZCBiZWNhdXNlIGl0IGhhcyBhIGNvbnRyb2wgY2hhcmFjdGVyIGluIGl0IChhIENSKS4NICBC
eSB0aGUgd2F5LCB5b3Ugc2hvdWxkIHJlYWxseSBnZXQgb3V0IG1vcmUu
b2RlZCBiZWNhdXNlIGl0IGhhcyBhIGNvbnRyb2wgY2hhcmFjdGVyIGluIGl0IChhIENSKS4NICBC
eSB0aGUgd2F5LCB5b3Ugc2hvdWxkIHJlYWxseSBnZXQgb3V0IG1vcmUu
objectclass: top
objectclass: person
objectclass: organizationalPerson
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -70,6 +70,20 @@ public void testJsonReading() throws Exception {
Assert.assertEquals(new BigDecimal("1.4"), trade.getPrice());
Assert.assertEquals(2, trade.getQuantity());

trade = itemReader.read();
Assert.assertNotNull(trade);
Assert.assertEquals("789", trade.getIsin());
Assert.assertEquals("foobar", trade.getCustomer());
Assert.assertEquals(new BigDecimal("1.6"), trade.getPrice());
Assert.assertEquals(3, trade.getQuantity());

trade = itemReader.read();
Assert.assertNotNull(trade);
Assert.assertEquals("100", trade.getIsin());
Assert.assertEquals("barfoo", trade.getCustomer());
Assert.assertEquals(new BigDecimal("1.8"), trade.getPrice());
Assert.assertEquals(4, trade.getQuantity());

trade = itemReader.read();
Assert.assertNull(trade);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2017 the original author or authors.
* Copyright 2010-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -26,6 +26,8 @@
import org.junit.Before;
import org.junit.Test;
import org.xmlunit.builder.Input;
import org.xmlunit.diff.DefaultNodeMatcher;
import org.xmlunit.diff.ElementSelectors;
import org.xmlunit.matchers.CompareMatcher;

import org.springframework.batch.item.ExecutionContext;
Expand Down Expand Up @@ -97,7 +99,8 @@ public Void doInTransaction(TransactionStatus status) {

assertThat(
Input.from(expected.getFile()),
CompareMatcher.isSimilarTo(Input.from(resource.getFile())));
CompareMatcher.isSimilarTo(Input.from(resource.getFile()))
.withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText)));
}

@Before
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2014 the original author or authors.
* Copyright 2010-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -101,7 +101,7 @@ public Void doInTransaction(TransactionStatus status) {

assertThat(
Input.from(expected.getFile()),
CompareMatcher.isSimilarTo(Input.from(resource.getFile())));
CompareMatcher.isSimilarTo(Input.from(resource.getFile())).normalizeWhitespace());
}

@Before
Expand Down

0 comments on commit 422c233

Please sign in to comment.