public class VerifyVersionInfoTestCase {
@Test
public void checkMatchVersion() throws Exception {
// given
VersionInfo info = VersionInfo.getVersionInfo();
Document doc = DocumentBuilderFactory.newInstance()
.newDocumentBuilder().parse(new File("pom.xml"));
NodeList list = doc.getDocumentElement().getChildNodes();
boolean found = false;
for (int i = 0; i < list.getLength() && !found; i++) {
Node n = list.item(i);
if (n instanceof Element
&& ((Element) n).getTagName().equals("version")) {
String version = n.getTextContent();
if (!version.equals(info.getVersion())) {
System.out
.println("VerifyVersionInfo.checkMatchVersion() WARNING: update the version in VersionInfo");
}
// assertEquals(version, info.getVersion());
found = true;
}
}
if (!found) {
File file = new File("../pom.xml");
if (file.exists()) {
doc = DocumentBuilderFactory.newInstance().newDocumentBuilder()
.parse(file);
list = doc.getDocumentElement().getChildNodes();
found = false;
for (int i = 0; i < list.getLength() && !found; i++) {
Node n = list.item(i);
if (n instanceof Element
&& ((Element) n).getTagName().equals("version")) {
String version = n.getTextContent();
if (!version.equals(info.getVersion())) {
System.out
.println("VerifyVersionInfo.checkMatchVersion() WARNING: update the version in VersionInfo");
}
// assertEquals(version, info.getVersion());
found = true;