diff --git a/core/pom.xml b/core/pom.xml
index 989066dd..1e751f33 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -80,9 +80,9 @@
- org.apache.httpcomponents
- httpclient
- 4.5.14
+ org.apache.httpcomponents.client5
+ httpclient5
+ 5.2.1
org.apache.maven
@@ -102,7 +102,7 @@
org.assertj
assertj-core
- 3.18.1
+ 3.24.2
diff --git a/core/src/main/java/org/imec/ivlab/core/version/RemoteVersionReader.java b/core/src/main/java/org/imec/ivlab/core/version/RemoteVersionReader.java
index 46c97fa7..e284e4b0 100644
--- a/core/src/main/java/org/imec/ivlab/core/version/RemoteVersionReader.java
+++ b/core/src/main/java/org/imec/ivlab/core/version/RemoteVersionReader.java
@@ -3,18 +3,20 @@
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.apache.http.util.EntityUtils;
+
+import org.apache.hc.client5.http.classic.methods.HttpGet;
+import org.apache.hc.client5.http.config.ConnectionConfig;
+import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
+import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
+import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
//import org.apache.logging.log4j.LogManager;
//import org.apache.logging.log4j.Logger;
import org.imec.ivlab.core.exceptions.ExternalConnectionException;
import org.imec.ivlab.core.exceptions.RemoteVersionCheckFailedException;
import java.io.IOException;
+import java.util.concurrent.TimeUnit;
public class RemoteVersionReader {
@@ -24,8 +26,9 @@ public class RemoteVersionReader {
private final static String OWNER = "smals-jy"; // Replace with your GitHub username or organization name
private final static String REPO_NAME = "evs"; // Replace with your repository name
private final static String LATEST_RELEASE_PATH = "/releases/latest";
- private final static int CONNECTION_TIMEOUT = 2000;
- private final static int SOCKET_TIMEOUT = 2000;
+ private final static int CONNECTION_TIMEOUT = 2;
+ private final static int SOCKET_TIMEOUT = 2;
+ private final static TimeUnit TIMEOUT_UNIT = TimeUnit.SECONDS;
protected static String getRemoteVersion() throws RemoteVersionCheckFailedException {
GitHubRelease latesGitHubRelease = getLatestGitHubRelease();
@@ -49,14 +52,28 @@ private static GitHubRelease getLatestGitHubRelease() throws RemoteVersionCheckF
private static String sendGetRequest(String url) throws ExternalConnectionException {
try {
- RequestConfig.Builder requestBuilder = RequestConfig.custom().setConnectTimeout(CONNECTION_TIMEOUT).setSocketTimeout(SOCKET_TIMEOUT);
- HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
- httpClientBuilder.setDefaultRequestConfig(requestBuilder.build());
- CloseableHttpClient httpClient = httpClientBuilder.build();
+
+ ConnectionConfig connectionConfig = ConnectionConfig
+ .custom()
+ .setConnectTimeout(CONNECTION_TIMEOUT, TIMEOUT_UNIT)
+ .setSocketTimeout(SOCKET_TIMEOUT, TIMEOUT_UNIT)
+ .build();
+
+ CloseableHttpClient httpClient = HttpClientBuilder
+ .create()
+ .setConnectionManager(
+ PoolingHttpClientConnectionManagerBuilder
+ .create()
+ .setDefaultConnectionConfig(connectionConfig)
+ .build()
+ )
+ .build();
HttpGet request = new HttpGet(url);
request.addHeader("Accept", "application/vnd.github.v3+json"); // Specify GitHub API version
- CloseableHttpResponse result = httpClient.execute(request);
- return EntityUtils.toString(result.getEntity(), "UTF-8");
+ return httpClient.execute(request, response -> {
+ response.getEntity();
+ return EntityUtils.toString(response.getEntity(), "UTF-8");
+ });
} catch (IOException e) {
throw new ExternalConnectionException(e);
}
diff --git a/core/src/test/java/org/imec/ivlab/core/RangeCheckerTest.java b/core/src/test/java/org/imec/ivlab/core/RangeCheckerTest.java
index b6b73870..87410487 100644
--- a/core/src/test/java/org/imec/ivlab/core/RangeCheckerTest.java
+++ b/core/src/test/java/org/imec/ivlab/core/RangeCheckerTest.java
@@ -7,23 +7,21 @@
import org.imec.ivlab.core.model.internal.mapper.medication.Suspension;
import org.imec.ivlab.core.model.internal.mapper.medication.TimeUnit;
import org.imec.ivlab.core.model.internal.mapper.medication.Weekday;
-import org.testng.Assert;
-import org.testng.annotations.Test;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import org.joda.time.LocalDate;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
-import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
+import static org.assertj.core.api.Assertions.assertThat;
+import org.testng.Assert;
+import org.testng.annotations.Test;
-@org.testng.annotations.Test
+@Test
public class RangeCheckerTest {
- @org.testng.annotations.Test
+ @Test
public void calculateActivePeriodsMedicationWithEndmomentAndStopped() {
MedicationEntry medicationEntry = createMedicationEntry(new LocalDate(2017, 5, 15), new LocalDate(2020, 10, 20));
medicationEntry.setSuspensions(createSuspensionsWithLastOneStopped());
@@ -31,14 +29,14 @@ public void calculateActivePeriodsMedicationWithEndmomentAndStopped() {
RangeChecker rangeChecker = new RangeChecker();
List periods = rangeChecker.calculateActivePeriods(medicationEntry);
- assertThat(periods, hasSize(3));
- assertThat(periods, contains( new Period(new LocalDate(2017, 5, 15), new LocalDate(2017, 7, 12)),
+ assertThat(periods).hasSize(3);
+ assertThat(periods).containsExactly( new Period(new LocalDate(2017, 5, 15), new LocalDate(2017, 7, 12)),
new Period(new LocalDate(2017, 9, 14), new LocalDate(2017, 9, 14)),
- new Period(new LocalDate(2017, 9, 20), new LocalDate(2020, 10, 17))));
+ new Period(new LocalDate(2017, 9, 20), new LocalDate(2020, 10, 17)));
}
- @org.testng.annotations.Test
+ @Test
public void calculateActivePeriodsMedicationWithoutEndmomentAndStopped() {
MedicationEntry medicationEntry = createMedicationEntry(new LocalDate(2017, 5, 15), null);
medicationEntry.setSuspensions(createSuspensionsWithLastOneStopped());
@@ -46,10 +44,10 @@ public void calculateActivePeriodsMedicationWithoutEndmomentAndStopped() {
RangeChecker rangeChecker = new RangeChecker();
List periods = rangeChecker.calculateActivePeriods(medicationEntry);
- assertThat(periods, hasSize(3));
- assertThat(periods, contains( new Period(new LocalDate(2017, 5, 15), new LocalDate(2017, 7, 12)),
+ assertThat(periods).hasSize(3);
+ assertThat(periods).containsExactly( new Period(new LocalDate(2017, 5, 15), new LocalDate(2017, 7, 12)),
new Period(new LocalDate(2017, 9, 14), new LocalDate(2017, 9, 14)),
- new Period(new LocalDate(2017, 9, 20), new LocalDate(2020, 10, 17))));
+ new Period(new LocalDate(2017, 9, 20), new LocalDate(2020, 10, 17)));
}
@@ -63,7 +61,7 @@ private MedicationEntry createMedicationEntry(LocalDate beginmoment, LocalDate e
}
- @org.testng.annotations.Test
+ @Test
public void calculateActivePeriodsMedicationWithEndmomentAndSuspended() {
MedicationEntry medicationEntry = createMedicationEntry(new LocalDate(2017, 5, 15), new LocalDate(2020, 10, 20));
medicationEntry.setSuspensions(createSuspensionsWithLastSuspended());
@@ -71,15 +69,15 @@ public void calculateActivePeriodsMedicationWithEndmomentAndSuspended() {
RangeChecker rangeChecker = new RangeChecker();
List periods = rangeChecker.calculateActivePeriods(medicationEntry);
- assertThat(periods, hasSize(4));
- assertThat(periods, contains( new Period(new LocalDate(2017, 5, 15), new LocalDate(2017, 7, 12)),
+ assertThat(periods).hasSize(4);
+ assertThat(periods).containsExactly( new Period(new LocalDate(2017, 5, 15), new LocalDate(2017, 7, 12)),
new Period(new LocalDate(2017, 9, 14), new LocalDate(2017, 9, 14)),
new Period(new LocalDate(2017, 9, 20), new LocalDate(2020, 10, 17)),
- new Period(new LocalDate(2020, 10, 20), new LocalDate(2020, 10, 20))));
+ new Period(new LocalDate(2020, 10, 20), new LocalDate(2020, 10, 20)));
}
- @org.testng.annotations.Test
+ @Test
public void calculateActivePeriodsMedicationWithoutEndmomentAndSuspended() {
MedicationEntry medicationEntry = createMedicationEntry(new LocalDate(2017, 5, 15), null);
medicationEntry.setSuspensions(createSuspensionsWithLastSuspended());
@@ -87,11 +85,11 @@ public void calculateActivePeriodsMedicationWithoutEndmomentAndSuspended() {
RangeChecker rangeChecker = new RangeChecker();
List periods = rangeChecker.calculateActivePeriods(medicationEntry);
- assertThat(periods, hasSize(4));
- assertThat(periods, contains( new Period(new LocalDate(2017, 5, 15), new LocalDate(2017, 7, 12)),
+ assertThat(periods).hasSize(4);
+ assertThat(periods).containsExactly( new Period(new LocalDate(2017, 5, 15), new LocalDate(2017, 7, 12)),
new Period(new LocalDate(2017, 9, 14), new LocalDate(2017, 9, 14)),
new Period(new LocalDate(2017, 9, 20), new LocalDate(2020, 10, 17)),
- new Period(new LocalDate(2020, 10, 20), null)));
+ new Period(new LocalDate(2020, 10, 20), null));
}
@@ -181,7 +179,7 @@ private List createSuspensionsWithLastSuspended() {
}
- @org.testng.annotations.Test
+ @Test
public void testIsActiveByDayNumberAndDailyFrequency() throws Exception {
LocalDate medicationBeginDate = new LocalDate(2017, 3, 2);
@@ -200,7 +198,7 @@ public void testIsActiveByDayNumberAndDailyFrequency() throws Exception {
}
- @org.testng.annotations.Test
+ @Test
public void testIsActiveByDayNumberAndWeeklyFrequency() throws Exception {
LocalDate medicationBeginDate = new LocalDate(2017, 3, 2);
@@ -235,7 +233,7 @@ public void testIsActiveByDayNumberAndWeeklyFrequency() throws Exception {
}
- @org.testng.annotations.Test
+ @Test
public void testIsActiveByWeekday() throws Exception {
LocalDate medicationBeginDate = new LocalDate(2017, 3, 2); // = THURSDAY
@@ -262,7 +260,7 @@ public void testIsActiveByWeekday() throws Exception {
}
- @org.testng.annotations.Test
+ @Test
public void testIsActiveByDateForMonthlyFrequencies() throws Exception {
LocalDate medicationBeginDate = new LocalDate(2017, 3, 2);
@@ -300,7 +298,7 @@ public void testIsActiveByDateForMonthlyFrequencies() throws Exception {
}
- @org.testng.annotations.Test
+ @Test
public void testIsActiveByDateForYearlyFrequencies() throws Exception {
LocalDate medicationBeginDate = new LocalDate(2017, 3, 2);
diff --git a/core/src/test/java/org/imec/ivlab/core/model/internal/parser/sumehr/SumehrMapper/SumehrMapperTest.java b/core/src/test/java/org/imec/ivlab/core/model/internal/parser/sumehr/SumehrMapper/SumehrMapperTest.java
index fbdb2dff..421655d7 100644
--- a/core/src/test/java/org/imec/ivlab/core/model/internal/parser/sumehr/SumehrMapper/SumehrMapperTest.java
+++ b/core/src/test/java/org/imec/ivlab/core/model/internal/parser/sumehr/SumehrMapper/SumehrMapperTest.java
@@ -1,7 +1,6 @@
package org.imec.ivlab.core.model.internal.parser.sumehr.SumehrMapper;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
+import static org.assertj.core.api.Assertions.assertThat;
import org.imec.ivlab.core.TestUtil;
import org.imec.ivlab.core.model.internal.parser.sumehr.Sumehr;
@@ -21,8 +20,8 @@ public void testKmehrToSumehr() {
Sumehr sumehr = SumehrMapper.kmehrToSumehr(sumehrList.getList().get(0).getKmehrMessage());
- assertThat(sumehr.getMedicationEntries(), hasSize(4));
- assertThat(sumehr.getHealthCareElements(), hasSize(6));
+ assertThat(sumehr.getMedicationEntries()).hasSize(4);
+ assertThat(sumehr.getHealthCareElements()).hasSize(6);
}
diff --git a/core/src/test/java/org/imec/ivlab/core/util/kmehr/KmehrExtractorTest.java b/core/src/test/java/org/imec/ivlab/core/util/kmehr/KmehrExtractorTest.java
index 04f17199..a7e91601 100644
--- a/core/src/test/java/org/imec/ivlab/core/util/kmehr/KmehrExtractorTest.java
+++ b/core/src/test/java/org/imec/ivlab/core/util/kmehr/KmehrExtractorTest.java
@@ -8,19 +8,17 @@
import java.util.Collection;
import java.util.Collections;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.IsEqual.equalTo;
+import static org.assertj.core.api.Assertions.assertThat;
@org.testng.annotations.Test
public class KmehrExtractorTest {
-
@Test
public void testGetKmehrEntryListWithURIs() {
KmehrEntryList kmehrEntryList = TestUtil.getKmehrEntryList("10-kmehrs-10-uris.txt");
- assertThat(CollectionUtils.size(removeNullValues(kmehrEntryList.getBusinessDataList())), equalTo(10));
- assertThat(CollectionUtils.size(removeNullValues(kmehrEntryList.getURIList())), equalTo(10));
+ assertThat(CollectionUtils.size(removeNullValues(kmehrEntryList.getBusinessDataList()))).isEqualTo(10);
+ assertThat(CollectionUtils.size(removeNullValues(kmehrEntryList.getURIList()))).isEqualTo(10);
}
@@ -28,8 +26,8 @@ public void testGetKmehrEntryListWithURIs() {
public void testGetKmehrEntryListWithURIsKmehrsNotAfterNewline() {
KmehrEntryList kmehrEntryList = TestUtil.getKmehrEntryList("10-kmehrs-10-uris-and-kmehrs-not-after-newline.txt");
- assertThat(CollectionUtils.size(removeNullValues(kmehrEntryList.getBusinessDataList())), equalTo(10));
- assertThat(CollectionUtils.size(removeNullValues(kmehrEntryList.getURIList())), equalTo(10));
+ assertThat(CollectionUtils.size(removeNullValues(kmehrEntryList.getBusinessDataList()))).isEqualTo(10);
+ assertThat(CollectionUtils.size(removeNullValues(kmehrEntryList.getURIList()))).isEqualTo(10);
}
@@ -37,8 +35,8 @@ public void testGetKmehrEntryListWithURIsKmehrsNotAfterNewline() {
public void testGetKmehrEntryListWithoutURIs() {
KmehrEntryList kmehrEntryList = TestUtil.getKmehrEntryList("10-kmehrs-no-uris.txt");
- assertThat(CollectionUtils.size(removeNullValues(kmehrEntryList.getBusinessDataList())), equalTo(10));
- assertThat(CollectionUtils.size(removeNullValues(kmehrEntryList.getURIList())), equalTo(0));
+ assertThat(CollectionUtils.size(removeNullValues(kmehrEntryList.getBusinessDataList()))).isEqualTo(10);
+ assertThat(CollectionUtils.size(removeNullValues(kmehrEntryList.getURIList()))).isEqualTo(0);
}
@@ -46,8 +44,8 @@ public void testGetKmehrEntryListWithoutURIs() {
public void testGetKmehrEntryListWithoutURIsKmehrsNotAfterNewline() {
KmehrEntryList kmehrEntryList = TestUtil.getKmehrEntryList("10-kmehrs-no-uris-and-kmehrs-not-after-newline.txt");
- assertThat(CollectionUtils.size(removeNullValues(kmehrEntryList.getBusinessDataList())), equalTo(10));
- assertThat(CollectionUtils.size(removeNullValues(kmehrEntryList.getURIList())), equalTo(0));
+ assertThat(CollectionUtils.size(removeNullValues(kmehrEntryList.getBusinessDataList()))).isEqualTo(10);
+ assertThat(CollectionUtils.size(removeNullValues(kmehrEntryList.getURIList()))).isEqualTo(0);
}
diff --git a/core/src/test/java/org/imec/ivlab/core/util/medicationscheme/MedicationSchemeExtractorTest.java b/core/src/test/java/org/imec/ivlab/core/util/medicationscheme/MedicationSchemeExtractorTest.java
index ed8d3f45..05c16e0f 100644
--- a/core/src/test/java/org/imec/ivlab/core/util/medicationscheme/MedicationSchemeExtractorTest.java
+++ b/core/src/test/java/org/imec/ivlab/core/util/medicationscheme/MedicationSchemeExtractorTest.java
@@ -12,8 +12,8 @@
import org.imec.ivlab.core.util.CollectionsUtil;
import org.testng.annotations.Test;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.IsEqual.equalTo;
+import static org.assertj.core.api.Assertions.assertThat;
+
import static org.testng.Assert.assertTrue;
public class MedicationSchemeExtractorTest {
@@ -23,9 +23,9 @@ public void testGetMedicationSchemeEntriesConnectorFormatWithURIS() throws Excep
KmehrEntryList kmehrEntryList = TestUtil.getKmehrEntryList("10-kmehrs-10-uris.txt");
MSEntryList medicationSchemeEntries = MedicationSchemeExtractor.getMedicationSchemeEntries(kmehrEntryList);
- assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries()), equalTo(10));
+ assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries())).isEqualTo(10);
for (MSEntry msEntry : medicationSchemeEntries.getMsEntries()) {
- assertThat(CollectionUtils.size(msEntry.getTsTransactions()), equalTo(0));
+ assertThat(CollectionUtils.size(msEntry.getTsTransactions())).isEqualTo(0);
}
ensureRegimenOrPosologyCorrectlyUnMarshalled(medicationSchemeEntries);
@@ -37,9 +37,9 @@ public void testGetMedicationSchemeEntriesConnectorFormatWithoutURIS() throws Ex
KmehrEntryList kmehrEntryList = TestUtil.getKmehrEntryList("10-kmehrs-no-uris.txt");
MSEntryList medicationSchemeEntries = MedicationSchemeExtractor.getMedicationSchemeEntries(kmehrEntryList);
- assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries()), equalTo(10));
+ assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries())).isEqualTo(10);
for (MSEntry msEntry : medicationSchemeEntries.getMsEntries()) {
- assertThat(CollectionUtils.size(msEntry.getTsTransactions()), equalTo(0));
+ assertThat(CollectionUtils.size(msEntry.getTsTransactions())).isEqualTo(0);
}
@@ -52,15 +52,15 @@ public void testGetMedicationSchemeEntriesGatewayFormat() throws Exception {
KmehrEntryList kmehrEntryList = TestUtil.getKmehrEntryList("3-kmehrs-gateway-format.txt");
MSEntryList medicationSchemeEntries = MedicationSchemeExtractor.getMedicationSchemeEntries(kmehrEntryList);
- assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries()), equalTo(5));
+ assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries())).isEqualTo(5);
- assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(0).getTsTransactions()), equalTo(0));
- assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(1).getTsTransactions()), equalTo(0));
+ assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(0).getTsTransactions())).isEqualTo(0);
+ assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(1).getTsTransactions())).isEqualTo(0);
- assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(2).getTsTransactions()), equalTo(1));
- assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(3).getTsTransactions()), equalTo(0));
+ assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(2).getTsTransactions())).isEqualTo(1);
+ assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(3).getTsTransactions())).isEqualTo(0);
- assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(4).getTsTransactions()), equalTo(2));
+ assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(4).getTsTransactions())).isEqualTo(2);
ensureRegimenOrPosologyCorrectlyUnMarshalled(medicationSchemeEntries);
@@ -87,19 +87,19 @@ public void testGetMedicationSchemeEntriesMixConnectorAndGatewayFormat() throws
KmehrEntryList kmehrEntryList = TestUtil.getKmehrEntryList("3-kmehrs-gateway-format-and-2-kmehrs-connector-format.txt");
MSEntryList medicationSchemeEntries = MedicationSchemeExtractor.getMedicationSchemeEntries(kmehrEntryList);
- assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries()), equalTo(7));
+ assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries())).isEqualTo(7);
- assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(0).getTsTransactions()), equalTo(0));
- assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(1).getTsTransactions()), equalTo(0));
+ assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(0).getTsTransactions())).isEqualTo(0);
+ assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(1).getTsTransactions())).isEqualTo(0);
- assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(2).getTsTransactions()), equalTo(1));
+ assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(2).getTsTransactions())).isEqualTo(1);
- assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(3).getTsTransactions()), equalTo(1));
- assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(4).getTsTransactions()), equalTo(0));
+ assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(3).getTsTransactions())).isEqualTo(1);
+ assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(4).getTsTransactions())).isEqualTo(0);
- assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(5).getTsTransactions()), equalTo(0));
+ assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(5).getTsTransactions())).isEqualTo(0);
- assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(6).getTsTransactions()), equalTo(2));
+ assertThat(CollectionUtils.size(medicationSchemeEntries.getMsEntries().get(6).getTsTransactions())).isEqualTo(2);
}
diff --git a/datagenerator/pom.xml b/datagenerator/pom.xml
index f4c586fb..f05522c1 100644
--- a/datagenerator/pom.xml
+++ b/datagenerator/pom.xml
@@ -46,11 +46,6 @@
-
- org.apache.pdfbox
- pdfbox
-
-
diff --git a/distribution/pom.xml b/distribution/pom.xml
index 679e25fe..6bf22867 100644
--- a/distribution/pom.xml
+++ b/distribution/pom.xml
@@ -18,8 +18,8 @@
- 2.3.0
- 2.3.0
+ 2.3.1
+ 2.3.1
1.3.2
EVS-${project.version}.jar
@@ -39,32 +39,6 @@
${izpack.version}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -126,6 +100,7 @@
maven-antrun-plugin
+ 3.1.0
create-staging-area
@@ -134,11 +109,11 @@
run
-
+
-
+
diff --git a/ehconnector/pom.xml b/ehconnector/pom.xml
index 733ece76..48f60230 100644
--- a/ehconnector/pom.xml
+++ b/ehconnector/pom.xml
@@ -39,7 +39,7 @@
commons-codec
commons-codec
- 1.10
+ 1.16.0
commons-collections
@@ -386,11 +386,6 @@
easystream
1.2.15
-
- net.sf.dozer
- dozer
- 5.5.1
-
org.jasypt
jasypt
@@ -423,7 +418,7 @@
org.apache.logging.log4j
- log4j-slf4j-impl
+ log4j-slf4j2-impl
2.20.0
@@ -497,7 +492,7 @@
org.unitils
unitils-core
- 3.4.2
+ 3.4.6
xmlunit
diff --git a/super/pom.xml b/super/pom.xml
index 752c1a04..64af95a7 100644
--- a/super/pom.xml
+++ b/super/pom.xml
@@ -51,18 +51,6 @@
log4j-core
-
- org.hamcrest
- hamcrest-core
- 1.3
-
-
-
- org.hamcrest
- hamcrest-library
- 1.3
-
-
com.google.code.gson
gson
@@ -97,12 +85,6 @@
1.82
-
- org.apache.pdfbox
- pdfbox
- 2.0.29
-
-
org.testng
testng
@@ -221,13 +203,13 @@
UTF-8
1.8
1.8
- 1.0
+ 1.5.0
${project.basedir}${file.separator}..${file.separator}..${file.separator}builds${file.separator}${project.version}${file.separator}
${build.install.directory.parent}${file.separator}EVS${file.separator}
${build.install.directory.parent}${file.separator}EVS-installer${file.separator}
${build.install.directory}${file.separator}system${file.separator}
${build.install.directory}${file.separator}system${file.separator}kmehr{file.separator}
- 5.0.0
+ 5.2.3
diff --git a/validator/src/test/java/matcher/ValidationMatchers.java b/validator/src/test/java/matcher/ValidationMatchers.java
index 16b65ec6..0dd8297c 100644
--- a/validator/src/test/java/matcher/ValidationMatchers.java
+++ b/validator/src/test/java/matcher/ValidationMatchers.java
@@ -1,178 +1,75 @@
package matcher;
-import org.apache.commons.collections.CollectionUtils;
+import java.util.List;
+
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
-import org.hamcrest.BaseMatcher;
-import org.hamcrest.Description;
-import org.hamcrest.Matcher;
+import org.assertj.core.api.Condition;
import org.imec.ivlab.core.util.CollectionsUtil;
-import org.imec.ivlab.validator.validators.business.rules.KmehrMessageRule;
import org.imec.ivlab.validator.validators.business.rules.Rule;
+//import org.imec.ivlab.validator.validators.business.rules.KmehrMessageRule;
import org.imec.ivlab.validator.validators.business.rules.model.RuleResult;
import org.imec.ivlab.validator.validators.model.AbstractValidationItem;
import org.imec.ivlab.validator.validators.model.ValidationResult;
-import java.util.List;
-import java.util.Objects;
-
public class ValidationMatchers {
- public static Matcher failsForRule(Class ruleClass) {
-
- T rule;
- try {
- rule = ruleClass.newInstance();
- } catch (Exception e) {
- throw new RuntimeException("Failed to istantiate rule.", e);
- }
-
- return new BaseMatcher() {
-
-
- @Override
- public boolean matches(final Object item) {
-
- final ValidationResult validationResult = (ValidationResult) item;
-
- List failedList = validationResult.getFailedList();
-
- for (AbstractValidationItem validationItem : failedList) {
- if (validationItem.getClass().isAssignableFrom(RuleResult.class)) {
- RuleResult ruleResult = (RuleResult) validationItem;
-
- if (Objects.equals(rule.getRuleId(), ruleResult.getRuleId())) {
- return true;
- }
- }
- }
-
- return false;
-
- }
-
- @Override
- public void describeTo(final Description description) {
- description.appendText("validationresult should have failed for rule ").appendValue(rule.getRuleId());
- }
-
- };
-
-
+ public static Condition failsForRule(Class ruleClass) {
+
+ T rule;
+ try {
+ rule = ruleClass.newInstance();
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to istantiate rule.", e);
+ }
+
+ return new Condition<>(validationResult -> {
+ return validationResult.getFailedList().stream()
+ .filter(validationItem -> validationItem instanceof RuleResult)
+ .map(validationItem -> (RuleResult) validationItem)
+ .anyMatch(ruleResult -> ruleResult.getRuleId().equals(rule.getRuleId()));
+ }, "validationresult should have failed for rule %s", rule.getRuleId());
}
- public static Matcher failsWithMessage(String containsMessageIgnoringCase) {
-
- return new BaseMatcher() {
-
-
- @Override
- public boolean matches(final Object item) {
-
- final ValidationResult validationResult = (ValidationResult) item;
-
- List failedList = validationResult.getFailedList();
-
- for (AbstractValidationItem validationItem : failedList) {
- if (StringUtils.containsIgnoreCase(validationItem.getMessage(), containsMessageIgnoringCase)) {
- return true;
- }
+ public static Condition failsWithMessage(String containsMessageIgnoringCase) {
+ return new Condition<>(validationResult -> {
+ List failedList = validationResult.getFailedList();
+ for (AbstractValidationItem validationItem : failedList) {
+ if (StringUtils.containsIgnoreCase(validationItem.getMessage(), containsMessageIgnoringCase)) {
+ return true;
}
-
- return false;
-
}
-
- @Override
- public void describeTo(final Description description) {
- description.appendText("validationresult should have failed with message " + containsMessageIgnoringCase);
- }
-
- };
-
-
+ return false;
+ }, "validationresult should have failed with message %s", containsMessageIgnoringCase);
}
- public static Matcher failsForAnyRule() {
-
-
- return new BaseMatcher() {
-
-
- @Override
- public boolean matches(final Object item) {
-
- final ValidationResult validationResult = (ValidationResult) item;
-
- return (CollectionsUtil.size(validationResult.getFailedList()) + CollectionUtils.size(validationResult.getInterruptedList())) > 0;
-
- }
-
- @Override
- public void describeTo(final Description description) {
- description.appendText("validationresult should have failed for at least one rule");
- }
-
- };
-
-
+ public static Condition failsForAnyRule() {
+ return new Condition<>(validationResult -> (CollectionsUtil.size(validationResult.getFailedList()) + CollectionUtils.size(validationResult.getInterruptedList())) > 0, "validationresult should have failed for at least one rule");
}
- /**
- * The ruleClass is not taken into account, we check that the message passed all rules. The class is passed as a reference to track relationship between tests and rules
- * @param ruleClass
- * @param
- * @return
- */
- public static Matcher passes(Class ruleClass) {
-
+ public static Condition passes(Class ruleClass) {
return passes();
-
-
}
- public static Matcher passes() {
-
- return new BaseMatcher() {
-
- ValidationResult validationResult;
-
- @Override
- public boolean matches(final Object item) {
-
- validationResult = (ValidationResult) item;
-
- return CollectionUtils.isEmpty(validationResult.getFailedList()) && CollectionUtils.isEmpty(validationResult.getInterruptedList());
+ public static Condition passes() {
+ return new Condition<>(ValidationMatchers::validatePasses, "validationresult should have passed all rules. Failing rule messages: %s", "");
+ }
+
+ private static boolean validatePasses(ValidationResult validationResult) {
+ return CollectionUtils.isEmpty(validationResult.getFailedList()) && CollectionUtils.isEmpty(validationResult.getInterruptedList());
+ }
+ public static String mergeMessages(ValidationResult validationResult) {
+ if (validationResult != null) {
+ StringBuilder stringBuilder = new StringBuilder();
+ for (AbstractValidationItem abstractValidationItem : validationResult.getFailedList()) {
+ stringBuilder.append(abstractValidationItem.getMessage()).append(System.lineSeparator());
}
-
- @Override
- public void describeTo(final Description description) {
- description.appendText("validationresult should have passed all rules. Failing rule messages: " + mergeMessages(validationResult));
+ for (AbstractValidationItem abstractValidationItem : validationResult.getInterruptedList()) {
+ stringBuilder.append(abstractValidationItem.getMessage()).append(System.lineSeparator());
}
-
- private String mergeMessages(ValidationResult validationResult) {
-
- if (validationResult != null) {
- StringBuffer stringBuffer = new StringBuffer();
- for (AbstractValidationItem abstractValidationItem : validationResult.getFailedList()) {
- stringBuffer.append(abstractValidationItem.getMessage() + System.lineSeparator());
- }
- for (AbstractValidationItem abstractValidationItem : validationResult.getInterruptedList()) {
- stringBuffer.append(abstractValidationItem.getMessage() + System.lineSeparator());
- }
-
- return stringBuffer.toString();
-
- }
-
- return null;
-
- }
-
- };
-
-
+ return stringBuilder.toString();
+ }
+ return null;
}
-
-
}
diff --git a/validator/src/test/java/org/imec/ivlab/validator/validators/KmehrBusinessValidatorTest.java b/validator/src/test/java/org/imec/ivlab/validator/validators/KmehrBusinessValidatorTest.java
index c280fc45..a4b0d721 100644
--- a/validator/src/test/java/org/imec/ivlab/validator/validators/KmehrBusinessValidatorTest.java
+++ b/validator/src/test/java/org/imec/ivlab/validator/validators/KmehrBusinessValidatorTest.java
@@ -1,7 +1,5 @@
package org.imec.ivlab.validator.validators;
-import static org.hamcrest.MatcherAssert.assertThat;
-
import be.fgov.ehealth.standards.kmehr.schema.v1.Kmehrmessage;
import matcher.ValidationMatchers;
import org.imec.ivlab.core.kmehr.KmehrMarshaller;
@@ -54,6 +52,8 @@
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
+import static org.assertj.core.api.Assertions.assertThat;
+
@org.testng.annotations.Test
public class KmehrBusinessValidatorTest {
@@ -83,477 +83,572 @@ public void init() {
@Test
public void validateXsdValidKmehr() {
- assertThat(validateTemplate("03_valid.xml"), ValidationMatchers.passes());
+ ValidationResult validationResult = validateTemplate("03_valid.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes());
}
@Test
public void validateTwoFolders() {
- assertThat(validateTemplate("05_two-folders.xml"), ValidationMatchers.failsForRule(R1100_OneFolder.class));
+ ValidationResult validationResult = validateTemplate("05_two-folders.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1100_OneFolder.class));
}
@Test
public void validateFrequency5DaysAndDaynumber6() {
- assertThat(validateTemplate("06_frequency-5-days-and-daynumber-6.xml"), ValidationMatchers.failsForRule(R1001b_MultipleOfDaysDayNumberValue.class));
+ ValidationResult validationResult = validateTemplate("06_frequency-5-days-and-daynumber-6.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1001b_MultipleOfDaysDayNumberValue.class));
}
-
+
@Test
public void validateFrequency5DaysAndDaynumber5() {
- assertThat(validateTemplate("07_frequency-5-days-and-daynumber-5.xml"), ValidationMatchers.passes());
+ ValidationResult validationResult = validateTemplate("07_frequency-5-days-and-daynumber-5.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes());
}
-
+
@Test
public void validateFrequency10DaysAndWeekday() {
- assertThat(validateTemplate("08_frequency-10-days-and-weekday.xml"), ValidationMatchers.failsForRule(R1001a_MultipleOfDaysAllowedFields.class));
+ ValidationResult validationResult = validateTemplate("08_frequency-10-days-and-weekday.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1001a_MultipleOfDaysAllowedFields.class));
}
-
+
@Test
public void validateFrequency10DaysAndDate() {
- assertThat(validateTemplate("09_frequency-10-days-and-date.xml"), ValidationMatchers.failsForRule(R1001a_MultipleOfDaysAllowedFields.class));
+ ValidationResult validationResult = validateTemplate("09_frequency-10-days-and-date.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1001a_MultipleOfDaysAllowedFields.class));
}
-
+
@Test
public void validateFrequency3weeksAndDate() {
- assertThat(validateTemplate("10_frequency-3-weeks-and-date.xml"), ValidationMatchers.failsForRule(R1001c_MultipleOfWeeksAllowedFields.class));
+ ValidationResult validationResult = validateTemplate("10_frequency-3-weeks-and-date.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1001c_MultipleOfWeeksAllowedFields.class));
}
-
+
@Test
public void validateFrequency6Weeks3RegimenAndOnly2Weekdays() {
- assertThat(validateTemplate("12_frequency-6-weeks-3-regimen-and-only-2-weekdays.xml"), ValidationMatchers.failsForRule(R1001e_DaynumberOrDayOrWeekdayCount.class));
+ ValidationResult validationResult = validateTemplate("12_frequency-6-weeks-3-regimen-and-only-2-weekdays.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1001e_DaynumberOrDayOrWeekdayCount.class));
}
-
+
@Test
public void validateFrequency6Weeks3RegimenAnd3Weekdays() {
- assertThat(validateTemplate("13_frequency-6-weeks-3-regimen-and-3-weekdays.xml"), ValidationMatchers.passes(R1001e_DaynumberOrDayOrWeekdayCount.class));
+ ValidationResult validationResult = validateTemplate("13_frequency-6-weeks-3-regimen-and-3-weekdays.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1001e_DaynumberOrDayOrWeekdayCount.class));
}
-
+
@Test
public void validateFrequency6Weeks1RegimenAndWithoutWeekdays() {
- assertThat(validateTemplate("14_frequency-6-weeks-1-regimen-and-without-weekdays.xml"), ValidationMatchers.passes(R1001e_DaynumberOrDayOrWeekdayCount.class));
+ ValidationResult validationResult = validateTemplate("14_frequency-6-weeks-1-regimen-and-without-weekdays.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1001e_DaynumberOrDayOrWeekdayCount.class));
}
-
+
@Test
public void validateFrequency6Weeks3RegimenAndWithoutWeekdays() {
- assertThat(validateTemplate("14b_frequency-6-weeks-3-regimen-and-without-weekdays.xml"), ValidationMatchers.passes(R1001e_DaynumberOrDayOrWeekdayCount.class));
+ ValidationResult validationResult = validateTemplate("14b_frequency-6-weeks-3-regimen-and-without-weekdays.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1001e_DaynumberOrDayOrWeekdayCount.class));
}
+
@Test
public void validateFrequency6Weeks3RegimenDaynumberAndWeekdaysMixed() {
- assertThat(validateTemplate("14c_frequency-6-weeks-3-regimen-with-daynumbers-and-weekdays-mixed.xml"), ValidationMatchers.failsForRule(R1001e_DaynumberOrDayOrWeekdayCount.class));
+ ValidationResult validationResult = validateTemplate("14c_frequency-6-weeks-3-regimen-with-daynumbers-and-weekdays-mixed.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1001e_DaynumberOrDayOrWeekdayCount.class));
}
-
+
@Test
public void validateNoFrequency1RegimenWithDaynumbers() {
- assertThat(validateTemplate("15_frequency-no-frequency-1-regimen-with-daynumbers.xml"), ValidationMatchers.failsForRule(R1001f_DayIfNoFrequency.class));
+ ValidationResult validationResult = validateTemplate("15_frequency-no-frequency-1-regimen-with-daynumbers.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1001f_DayIfNoFrequency.class));
}
-
+
@Test
public void validateNoFrequency1RegimenWithWeekdays() {
- assertThat(validateTemplate("15b_frequency-no-frequency-1-regimen-with-weekdays.xml"), ValidationMatchers.failsForRule(R1001f_DayIfNoFrequency.class));
+ ValidationResult validationResult = validateTemplate("15b_frequency-no-frequency-1-regimen-with-weekdays.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1001f_DayIfNoFrequency.class));
}
-
+
@Test
public void validateNoFrequency1RegimenWithoutDaynumbersDatesOrWeekdays() {
- assertThat(validateTemplate("16_frequency-no-frequency-1-regimen-without-daynumbers-dates-or-weekdays.xml"), ValidationMatchers.failsForRule(R1001f_DayIfNoFrequency.class));
+ ValidationResult validationResult = validateTemplate("16_frequency-no-frequency-1-regimen-without-daynumbers-dates-or-weekdays.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1001f_DayIfNoFrequency.class));
}
-
+
@Test
public void validateFrequency9MonthsAndDayNumber() {
- assertThat(validateTemplate("17_frequency-9-months-and-daynumber.xml"), ValidationMatchers.failsForRule(R1001g_MultipleOfMonthsAllowedFields.class));
+ ValidationResult validationResult = validateTemplate("17_frequency-9-months-and-daynumber.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1001g_MultipleOfMonthsAllowedFields.class));
}
-
+
@Test
public void validateFrequency1YearAndWeekday() {
- assertThat(validateTemplate("18_frequency-1-year-and-weekday.xml"), ValidationMatchers.failsForRule(R1001i_MultipleOfYearsAllowedFields.class));
+ ValidationResult validationResult = validateTemplate("18_frequency-1-year-and-weekday.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1001i_MultipleOfYearsAllowedFields.class));
}
-
+
@Test
public void validateFrequency9MonthsAndDate() {
- assertThat(validateTemplate("19_frequency-9-months-and-date.xml"), ValidationMatchers.passes());
+ ValidationResult validationResult = validateTemplate("19_frequency-9-months-and-date.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes());
}
-
+
@Test
public void validateFrequency9MonthsAndDateDayvalue29() {
- assertThat(validateTemplate("20_frequency-9-months-and-date-dayvalue-29.xml"), ValidationMatchers.failsForRule(R1001h_MultipleOfMonthsDayLimitInDate.class));
+ ValidationResult validationResult = validateTemplate("20_frequency-9-months-and-date-dayvalue-29.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1001h_MultipleOfMonthsDayLimitInDate.class));
}
-
+
@Test
public void validateFrequency2YearsAndDateDayValue28February() {
- assertThat(validateTemplate("21_frequency-2-years-and-date-dayvalue-february-28.xml"), ValidationMatchers.passes(R1001j_MultipleOfYearsDayLimitInDate.class));
+ ValidationResult validationResult = validateTemplate("21_frequency-2-years-and-date-dayvalue-february-28.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1001j_MultipleOfYearsDayLimitInDate.class));
}
-
+
@Test
public void validateFrequency2YearsAndDateDayValue29February() {
- assertThat(validateTemplate("22_frequency-2-years-and-date-dayvalue-february-29.xml"), ValidationMatchers.failsForRule(R1001j_MultipleOfYearsDayLimitInDate.class));
+ ValidationResult validationResult = validateTemplate("22_frequency-2-years-and-date-dayvalue-february-29.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1001j_MultipleOfYearsDayLimitInDate.class));
}
-
+
@Test
public void validateTakingTimesUnique() {
- assertThat(validateTemplate("23_taking-times-different.xml"), ValidationMatchers.passes(R1002_UniqueTakingTimes.class));
+ ValidationResult validationResult = validateTemplate("23_taking-times-different.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1002_UniqueTakingTimes.class));
}
-
+
@Test
public void validateTakingTimesIdenticalDayperiodDifferentDaynumbers() {
- assertThat(validateTemplate("24_taking-times-identical-dayperiod-different-daynumber.xml"), ValidationMatchers.passes(R1002_UniqueTakingTimes.class));
+ ValidationResult validationResult = validateTemplate("24_taking-times-identical-dayperiod-different-daynumber.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1002_UniqueTakingTimes.class));
}
-
+
@Test
public void validateTakingTimesIdenticalDayperiodIdenticalDaynumbers() {
- assertThat(validateTemplate("24b_taking-times-identical-dayperiod-identical-daynumber.xml"), ValidationMatchers.failsForRule(R1002_UniqueTakingTimes.class));
+ ValidationResult validationResult = validateTemplate("24b_taking-times-identical-dayperiod-identical-daynumber.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1002_UniqueTakingTimes.class));
}
-
+
@Test
public void validateTakingTimesIdenticalTimeDifferentWeekdays() {
- assertThat(validateTemplate("25_taking-times-identical-time-different-weekdays.xml"), ValidationMatchers.passes(R1002_UniqueTakingTimes.class));
+ ValidationResult validationResult = validateTemplate("25_taking-times-identical-time-different-weekdays.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1002_UniqueTakingTimes.class));
}
-
-
+
@Test
public void validateTakingTimesIdenticalTimeIdenticalWeekdays() {
- assertThat(validateTemplate("25b_taking-times-identical-time-identical-weekdays.xml"), ValidationMatchers.failsForRule(R1002_UniqueTakingTimes.class));
+ ValidationResult validationResult = validateTemplate("25b_taking-times-identical-time-identical-weekdays.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1002_UniqueTakingTimes.class));
}
-
-
+
@Test
public void validateInvalidXmlStructure() {
- assertThat(validateTemplate("26_not-respecting-xsd-mandatory-field-missing.xml"), ValidationMatchers.failsWithMessage("cvc-complex-type.2.4.a:"));
+ ValidationResult validationResult = validateTemplate("26_not-respecting-xsd-mandatory-field-missing.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsWithMessage("cvc-complex-type.2.4.a:"));
}
-
+
@Test
public void validateTemporalityValid() {
- assertThat(validateTemplate("29_temporality-valid.xml"), ValidationMatchers.passes(R1004_TemporalityPresent.class));
+ ValidationResult validationResult = validateTemplate("29_temporality-valid.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1004_TemporalityPresent.class));
}
-
+
@Test
public void validateTemporalityMissing() {
- assertThat(validateTemplate("30_temporality-missing.xml"), ValidationMatchers.failsForRule(R1004_TemporalityPresent.class));
+ ValidationResult validationResult = validateTemplate("30_temporality-missing.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1004_TemporalityPresent.class));
}
-
+
@Test
public void validateAdministrationunitIdentical() {
- assertThat(validateTemplate("32_quantity-unit-identical.xml"), ValidationMatchers.passes(R1005_PresentAndIdenticalAdministrationUnits.class));
+ ValidationResult validationResult = validateTemplate("32_quantity-unit-identical.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1005_PresentAndIdenticalAdministrationUnits.class));
}
-
+
@Test
public void validateAdministrationunitMissing() {
- assertThat(validateTemplate("33_quantity-unit-missing.xml"), ValidationMatchers.failsForRule(R1005_PresentAndIdenticalAdministrationUnits.class));
+ ValidationResult validationResult = validateTemplate("33_quantity-unit-missing.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1005_PresentAndIdenticalAdministrationUnits.class));
}
-
+
@Test
public void validateAdministrationunitDifferent() {
- assertThat(validateTemplate("34_quantity-unit-different.xml"), ValidationMatchers.failsForRule(R1005_PresentAndIdenticalAdministrationUnits.class));
+ ValidationResult validationResult = validateTemplate("34_quantity-unit-different.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1005_PresentAndIdenticalAdministrationUnits.class));
}
+
@Test
public void validateAdministrationunitNoRegimen() {
- assertThat(validateTemplate("34b_quantity-unit-no-regimen.xml"), ValidationMatchers.passes(R1005_PresentAndIdenticalAdministrationUnits.class));
+ ValidationResult validationResult = validateTemplate("34b_quantity-unit-no-regimen.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1005_PresentAndIdenticalAdministrationUnits.class));
}
-
+
@Test
public void validateFreeTextTooLong() {
- assertThat(validateTemplate("35_instruction-for-patient-too-long.xml"), ValidationMatchers.failsForRule(R1006_FreeTextMaxLength.class));
+ ValidationResult validationResult = validateTemplate("35_instruction-for-patient-too-long.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1006_FreeTextMaxLength.class));
}
-
+
@Test
public void validateFreeTextMaxLength() {
- assertThat(validateTemplate("36_instruction-for-patient-max-length.xml"), ValidationMatchers.passes(R1006_FreeTextMaxLength.class));
+ ValidationResult validationResult = validateTemplate("36_instruction-for-patient-max-length.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1006_FreeTextMaxLength.class));
}
-
+
@Test
public void validateSuspensionMedicationSameAsInMedicationTransaction() {
- assertThat(validateTemplate("37_suspension-medicaton-equal-to-medication-in-medication-transaction.xml"), ValidationMatchers.passes(R1007_TreatmentsuspensionMedicationEqualsMedicationInMedicationTransaction.class));
+ ValidationResult validationResult = validateTemplate("37_suspension-medicaton-equal-to-medication-in-medication-transaction.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1007_TreatmentsuspensionMedicationEqualsMedicationInMedicationTransaction.class));
}
-
+
@Test
public void validateSuspensionMedicationDifferentFromMedicationTransaction() {
- assertThat(validateTemplate("38_suspension-medicaton-different-from-medication-in-medication-transaction.xml"), ValidationMatchers.failsForRule(R1007_TreatmentsuspensionMedicationEqualsMedicationInMedicationTransaction.class));
+ ValidationResult validationResult = validateTemplate("38_suspension-medicaton-different-from-medication-in-medication-transaction.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1007_TreatmentsuspensionMedicationEqualsMedicationInMedicationTransaction.class));
}
-
+
@Test
public void validateBeginmomentMedicationTypeYear() {
- assertThat(validateTemplate("39_beginmoment-medication-type-year.xml"), ValidationMatchers.failsForRule(R1008_DateTypeForBeginmomentAndEndmoment.class));
+ ValidationResult validationResult = validateTemplate("39_beginmoment-medication-type-year.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1008_DateTypeForBeginmomentAndEndmoment.class));
}
-
+
@Test
public void validateEndmomentSuspensionTypeYearMonth() {
- assertThat(validateTemplate("40_endmoment-suspension-type-yearmonth.xml"), ValidationMatchers.failsForRule(R1008_DateTypeForBeginmomentAndEndmoment.class));
+ ValidationResult validationResult = validateTemplate("40_endmoment-suspension-type-yearmonth.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1008_DateTypeForBeginmomentAndEndmoment.class));
}
-
+
@Test
public void validateBeginAndEndmomentsTypesDate() {
- assertThat(validateTemplate("41_beginmoments-and-endmoments-type-date.xml"), ValidationMatchers.passes(R1008_DateTypeForBeginmomentAndEndmoment.class));
+ ValidationResult validationResult = validateTemplate("41_beginmoments-and-endmoments-type-date.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1008_DateTypeForBeginmomentAndEndmoment.class));
}
-
+
@Test
public void validateFrequency1HourAndRegimen() {
- assertThat(validateTemplate("42_frequency-1-hour-and-regimen.xml"), ValidationMatchers.failsForRule(R1009_HourlyFrequencyInCombinationWithRegiment.class));
+ ValidationResult validationResult = validateTemplate("42_frequency-1-hour-and-regimen.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1009_HourlyFrequencyInCombinationWithRegiment.class));
}
-
+
@Test
public void validateDateTypeOfTypeYear() {
- assertThat(validateTemplate("43_birthdate-of-type-year.xml"), ValidationMatchers.failsForRule(R1014_NoPartialDates.class));
+ ValidationResult validationResult = validateTemplate("43_birthdate-of-type-year.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1014_NoPartialDates.class));
}
-
+
@Test
public void validateDateTypeOfTypeDate() {
- assertThat(validateTemplate("44_birthdate-of-type-date.xml"), ValidationMatchers.passes(R1014_NoPartialDates.class));
+ ValidationResult validationResult = validateTemplate("44_birthdate-of-type-date.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1014_NoPartialDates.class));
}
-
+
@Test
public void validateDateTypeOfTypeYearmonth() {
- assertThat(validateTemplate("45_birthdate-of-type-yearmonth.xml"), ValidationMatchers.failsForRule(R1014_NoPartialDates.class));
+ ValidationResult validationResult = validateTemplate("45_birthdate-of-type-yearmonth.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1014_NoPartialDates.class));
}
-
+
@Test
public void validateNoDeliveredCnkOrName() {
- assertThat(validateTemplate("46_no-delivered-cnk-or-name.xml"), ValidationMatchers.passes(R1010_NoDeliveredname.class));
+ ValidationResult validationResult = validateTemplate("46_no-delivered-cnk-or-name.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1010_NoDeliveredname.class));
}
-
+
@Test
public void validateDeliveredCnkDifferent() {
- assertThat(validateTemplate("47_delivered-cnk-different.xml"), ValidationMatchers.failsForRule(R1010_NoDeliveredname.class));
+ ValidationResult validationResult = validateTemplate("47_delivered-cnk-different.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1010_NoDeliveredname.class));
}
-
+
@Test
public void validateDeliveredNameDifferent() {
- assertThat(validateTemplate("48_delivered-name-equal-no-cd.xml"), ValidationMatchers.failsForRule(R1010_NoDeliveredname.class));
+ ValidationResult validationResult = validateTemplate("48_delivered-name-equal-no-cd.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1010_NoDeliveredname.class));
}
-
+
@Test
public void validateDeliveredCnkAndNameEqual() {
- assertThat(validateTemplate("49_delivered-cnkd-and-name-equal.xml"), ValidationMatchers.passes(R1010_NoDeliveredname.class));
+ ValidationResult validationResult = validateTemplate("49_delivered-cnkd-and-name-equal.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1010_NoDeliveredname.class));
}
-
+
@Test
public void validateSuspensionStoppedAndEndDate() {
- assertThat(validateTemplate("50_suspension-stopped-and-enddate.xml"), ValidationMatchers.failsForRule(R1011_TreatmentSuspensionEnddateVersusType.class));
+ ValidationResult validationResult = validateTemplate("50_suspension-stopped-and-enddate.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1011_TreatmentSuspensionEnddateVersusType.class));
}
-
+
@Test
public void validateSuspensionStoppedAndNoEndDate() {
- assertThat(validateTemplate("51_suspension-stopped-and-no-enddate.xml"), ValidationMatchers.passes(R1011_TreatmentSuspensionEnddateVersusType.class));
+ ValidationResult validationResult = validateTemplate("51_suspension-stopped-and-no-enddate.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1011_TreatmentSuspensionEnddateVersusType.class));
}
-
+
@Test
public void validateSuspensionSuspendedAndEndDate() {
- assertThat(validateTemplate("52_suspension-suspended-and-enddate.xml"), ValidationMatchers.passes(R1011_TreatmentSuspensionEnddateVersusType.class));
+ ValidationResult validationResult = validateTemplate("52_suspension-suspended-and-enddate.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1011_TreatmentSuspensionEnddateVersusType.class));
}
-
+
@Test
public void validateSuspensionSuspendedAndNoEndDate() {
- assertThat(validateTemplate("53_suspension-suspended-and-no-enddate.xml"), ValidationMatchers.failsForRule(R1011_TreatmentSuspensionEnddateVersusType.class));
+ ValidationResult validationResult = validateTemplate("53_suspension-suspended-and-no-enddate.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1011_TreatmentSuspensionEnddateVersusType.class));
}
-
+
@Test
public void validateSuspensionCountHigherThanMaximum() {
- assertThat(validateTemplate("54_suspension-count-higher-than-maximum.xml"), ValidationMatchers.failsForRule(R1013_MaximumNumberOfTreatmentSuspensions.class));
+ ValidationResult validationResult = validateTemplate("54_suspension-count-higher-than-maximum.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1013_MaximumNumberOfTreatmentSuspensions.class));
}
-
+
@Test
public void validateDayperiodInvalid() {
- assertThat(validateTemplate("55_dayperiod-unsupported-value.xml"), ValidationMatchers.failsForRule(R1015_AllowedValuesCdDayperiod.class));
+ ValidationResult validationResult = validateTemplate("55_dayperiod-unsupported-value.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1015_AllowedValuesCdDayperiod.class));
}
-
+
@Test
public void validateFrequencyInvalid() {
- assertThat(validateTemplate("56_frequency-unsupported-value.xml"), ValidationMatchers.failsForRule(R1016_AllowedValuesCdPeriodicity.class));
+ ValidationResult validationResult = validateTemplate("56_frequency-unsupported-value.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1016_AllowedValuesCdPeriodicity.class));
}
-
+
@Test
public void validateAdministrationUnitNonVitalink() {
- assertThat(validateTemplate("57_administrationunit-non-vitalink.xml"), ValidationMatchers.failsForRule(R1024_VitalinkSupportedAdministrationUnits.class));
+ ValidationResult validationResult = validateTemplate("57_administrationunit-non-vitalink.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1024_VitalinkSupportedAdministrationUnits.class));
}
-
+
@Test
public void validateTransactionIdNotUnique() {
- assertThat(validateTemplate("59_transactionID-not-unique.xml"), ValidationMatchers.failsForRule(R1019_UniqueTransactionIDs.class));
+ ValidationResult validationResult = validateTemplate("59_transactionID-not-unique.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1019_UniqueTransactionIDs.class));
}
-
+
@Test
public void validateTransactionIdBlank() {
- assertThat(validateTemplate("60_transactionID-blank.xml"), ValidationMatchers.failsForRule(R1019_UniqueTransactionIDs.class));
+ ValidationResult validationResult = validateTemplate("60_transactionID-blank.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1019_UniqueTransactionIDs.class));
}
-
+
@Test
public void validateTransactionIdTwoEntries() {
- assertThat(validateTemplate("61_transactionID-two-entries.xml"), ValidationMatchers.failsForRule(R1019_UniqueTransactionIDs.class));
+ ValidationResult validationResult = validateTemplate("61_transactionID-two-entries.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1019_UniqueTransactionIDs.class));
}
-
+
@Test
public void validateSuspensionStoppedAndDuration() {
- assertThat(validateTemplate("62_suspension-stopped-and-duration.xml"), ValidationMatchers.failsForRule(R1011_TreatmentSuspensionEnddateVersusType.class));
+ ValidationResult validationResult = validateTemplate("62_suspension-stopped-and-duration.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1011_TreatmentSuspensionEnddateVersusType.class));
}
-
+
@Test
public void validateSuspensionStoppedAndNoDuration() {
- assertThat(validateTemplate("63_suspension-stopped-and-no-duration.xml"), ValidationMatchers.passes(R1011_TreatmentSuspensionEnddateVersusType.class));
+ ValidationResult validationResult = validateTemplate("63_suspension-stopped-and-no-duration.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1011_TreatmentSuspensionEnddateVersusType.class));
}
-
+
@Test
public void validateSuspensionSuspendedAndDuration() {
- assertThat(validateTemplate("64_suspension-suspended-and-duration.xml"), ValidationMatchers.passes(R1011_TreatmentSuspensionEnddateVersusType.class));
+ ValidationResult validationResult = validateTemplate("64_suspension-suspended-and-duration.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1011_TreatmentSuspensionEnddateVersusType.class));
}
-
+
@Test
public void validateSuspensionSuspendedAndNoDuration() {
- assertThat(validateTemplate("65_suspension-suspended-and-no-duration.xml"), ValidationMatchers.failsForRule(R1011_TreatmentSuspensionEnddateVersusType.class));
+ ValidationResult validationResult = validateTemplate("65_suspension-suspended-and-no-duration.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1011_TreatmentSuspensionEnddateVersusType.class));
}
-
+
@Test
public void validateEndmomentAndDurationForMedicationTransaction() {
- assertThat(validateTemplate("66_medicationtransaction-duration-and-endmoment.xml"), ValidationMatchers.failsForRule(R1020_EnddateCombinedWithDuration.class));
+ ValidationResult validationResult = validateTemplate("66_medicationtransaction-duration-and-endmoment.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1020_EnddateCombinedWithDuration.class));
}
-
+
@Test
public void validateEndmomentAndDurationForSuspensionTransaction() {
- assertThat(validateTemplate("67_suspensiontransaction-duration-and-endmoment.xml"), ValidationMatchers.failsForRule(R1020_EnddateCombinedWithDuration.class));
+ ValidationResult validationResult = validateTemplate("67_suspensiontransaction-duration-and-endmoment.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1020_EnddateCombinedWithDuration.class));
}
-
+
@Test
public void validateDurationValueZero() {
- assertThat(validateTemplate("68_durationvalue-zero.xml"), ValidationMatchers.failsForRule(R1022_DurationValueNonZeroNaturalNumber.class));
+ ValidationResult validationResult = validateTemplate("68_durationvalue-zero.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1022_DurationValueNonZeroNaturalNumber.class));
}
-
+
@Test
public void validateDurationValueTrailingZeroes() {
- assertThat(validateTemplate("69_durationvalue-fractionaldigits.xml"), ValidationMatchers.failsForRule(R1022_DurationValueNonZeroNaturalNumber.class));
+ ValidationResult validationResult = validateTemplate("69_durationvalue-fractionaldigits.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1022_DurationValueNonZeroNaturalNumber.class));
}
-
+
@Test
public void validateDurationTimeUnitInvalidKmehrCode() {
- assertThat(validateTemplate("70_durationtimeunit-unexisting-kmehrcode.xml"), ValidationMatchers.failsForRule(R1021_DurationTimeUnitAllowedCodes.class));
+ ValidationResult validationResult = validateTemplate("70_durationtimeunit-unexisting-kmehrcode.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1021_DurationTimeUnitAllowedCodes.class));
}
-
+
@Test
public void validateDurationTimeUnitUnsupportedCode() {
- assertThat(validateTemplate("71_durationtimeunit-notallowed-code.xml"), ValidationMatchers.failsForRule(R1021_DurationTimeUnitAllowedCodes.class));
+ ValidationResult validationResult = validateTemplate("71_durationtimeunit-notallowed-code.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1021_DurationTimeUnitAllowedCodes.class));
}
-
+
@Test
public void validateTemporalityInvalid() {
- assertThat(validateTemplate("72_temporality-unsupported-value.xml"), ValidationMatchers.failsForRule(R1017_AllowedValuesCdTemporality.class));
+ ValidationResult validationResult = validateTemplate("72_temporality-unsupported-value.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1017_AllowedValuesCdTemporality.class));
}
-
+
@Test
public void validateRouteInvalid() {
- assertThat(validateTemplate("73_route-unsupported-value.xml"), ValidationMatchers.failsForRule(R1018_AllowedValuesCdDrugroute.class));
+ ValidationResult validationResult = validateTemplate("73_route-unsupported-value.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1018_AllowedValuesCdDrugroute.class));
}
-
+
@Test
public void validateNaturalNumber5IntegerDigits() {
- assertThat(validateTemplate("74_naturalnumber-5-integerdigits.xml"), ValidationMatchers.failsForRule(R1012_QuantityValueLimited.class));
+ ValidationResult validationResult = validateTemplate("74_naturalnumber-5-integerdigits.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1012_QuantityValueLimited.class));
}
-
+
@Test
public void validateRationalNumber2IntegerDigits() {
- assertThat(validateTemplate("75_rationalnumber-2-integerdigits.xml"), ValidationMatchers.failsForRule(R1012_QuantityValueLimited.class));
+ ValidationResult validationResult = validateTemplate("75_rationalnumber-2-integerdigits.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1012_QuantityValueLimited.class));
}
-
+
@Test
public void validateRationalNumber3FractionalDigits() {
- assertThat(validateTemplate("76_rationalnumber-3-fractionaldigits.xml"), ValidationMatchers.failsForRule(R1012_QuantityValueLimited.class));
+ ValidationResult validationResult = validateTemplate("76_rationalnumber-3-fractionaldigits.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1012_QuantityValueLimited.class));
}
-
+
@Test
public void validateMixOfAllowedNumbers() {
- assertThat(validateTemplate("77_mix-of-allowed-numbers.xml"), ValidationMatchers.passes(R1012_QuantityValueLimited.class));
+ ValidationResult validationResult = validateTemplate("77_mix-of-allowed-numbers.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1012_QuantityValueLimited.class));
}
-
+
@Test
public void validateTrailingZeroes() {
- assertThat(validateTemplate("78_trailing-zeroes.xml"), ValidationMatchers.failsForRule(R1023_QuantityTrailingZeroes.class));
+ ValidationResult validationResult = validateTemplate("78_trailing-zeroes.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1023_QuantityTrailingZeroes.class));
}
-
+
@Test
public void validateMissingPosologyAndRegimen() {
- assertThat(validateTemplate("79_missing-posology-and-regimen.xml"), ValidationMatchers.failsForRule(R1027_PosologyOrRegimen.class));
+ ValidationResult validationResult = validateTemplate("79_missing-posology-and-regimen.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1027_PosologyOrRegimen.class));
}
-
+
@Test
public void validateQuantityNegativeNumber() {
- assertThat(validateTemplate("80_quantity-negative-number.xml"), ValidationMatchers.failsForRule(R1028_QuantityNonZeroPositiveNumber.class));
+ ValidationResult validationResult = validateTemplate("80_quantity-negative-number.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1028_QuantityNonZeroPositiveNumber.class));
}
-
+
@Test
public void validateQuantityZero() {
- assertThat(validateTemplate("81_quantity-zero.xml"), ValidationMatchers.failsForRule(R1028_QuantityNonZeroPositiveNumber.class));
+ ValidationResult validationResult = validateTemplate("81_quantity-zero.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1028_QuantityNonZeroPositiveNumber.class));
}
-
+
@Test
public void validateDurationValueNegativeDigits() {
- assertThat(validateTemplate("82_durationvalue-negativedigits.xml"), ValidationMatchers.failsForRule(R1022_DurationValueNonZeroNaturalNumber.class));
+ ValidationResult validationResult = validateTemplate("82_durationvalue-negativedigits.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1022_DurationValueNonZeroNaturalNumber.class));
}
-
+
@Test
public void validateUnexpectedTable() {
- assertThat(validateTemplate("83_unexpected-table.xml"), ValidationMatchers.failsForRule(R1025_OnlyExpectedKmehrTables.class));
+ ValidationResult validationResult = validateTemplate("83_unexpected-table.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1025_OnlyExpectedKmehrTables.class));
}
-
+
@Test
public void validateUnexpectedTableVersion() {
- assertThat(validateTemplate("84_unexpected-table-version.xml"), ValidationMatchers.failsForRule(R1026_OnlyExpectedKmehrTableVersions.class));
+ ValidationResult validationResult = validateTemplate("84_unexpected-table-version.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1026_OnlyExpectedKmehrTableVersions.class));
}
-
+
@Test
public void validateUnexpectedCodeForTableVersion() {
- assertThat(validateTemplate("85_unexpected-code-for-table-version.xml"), ValidationMatchers.failsForRule(R1029_OnlyExpectedCodeForKmehrTableVersions.class));
+ ValidationResult validationResult = validateTemplate("85_unexpected-code-for-table-version.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1029_OnlyExpectedCodeForKmehrTableVersions.class));
}
-
+
@Test
public void validateFrequency3WeeksAndDaynumber21() {
- assertThat(validateTemplate("86_frequency-3-weeks-and-daynumber-21.xml"), ValidationMatchers.passes(R1001k_MultipleOfWeeksDayNumberValue.class));
+ ValidationResult validationResult = validateTemplate("86_frequency-3-weeks-and-daynumber-21.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1001k_MultipleOfWeeksDayNumberValue.class));
}
@Test
public void validateFrequency3WeeksAndDaynumber22() {
- assertThat(validateTemplate("87_frequency-3-weeks-and-daynumber-22.xml"), ValidationMatchers.failsForRule(R1001k_MultipleOfWeeksDayNumberValue.class));
+ ValidationResult validationResult = validateTemplate("87_frequency-3-weeks-and-daynumber-22.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1001k_MultipleOfWeeksDayNumberValue.class));
}
@Test
public void validateFrequency1WeekAndDaynumber7() {
- assertThat(validateTemplate("88_frequency-1-week-and-daynumber-7.xml"), ValidationMatchers.passes(R1001k_MultipleOfWeeksDayNumberValue.class));
+ ValidationResult validationResult = validateTemplate("88_frequency-1-week-and-daynumber-7.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1001k_MultipleOfWeeksDayNumberValue.class));
}
@Test
public void validateFrequency1WeekAndDaynumber1() {
- assertThat(validateTemplate("89_frequency-1-week-and-daynumber-1.xml"), ValidationMatchers.passes(R1001k_MultipleOfWeeksDayNumberValue.class));
+ ValidationResult validationResult = validateTemplate("89_frequency-1-week-and-daynumber-1.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1001k_MultipleOfWeeksDayNumberValue.class));
}
@Test
public void validateFrequency1WeekAndDaynumber0() {
- assertThat(validateTemplate("90_frequency-1-week-and-daynumber-0.xml"), ValidationMatchers.failsForRule(R1001l_DaynumberValue.class));
+ ValidationResult validationResult = validateTemplate("90_frequency-1-week-and-daynumber-0.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1001l_DaynumberValue.class));
}
@Test
public void validateIsCompleteFalse() {
- assertThat(validateTemplate("91_iscomplete-false.xml"), ValidationMatchers.failsForRule(R1032_IscompleteIsTrue.class));
+ ValidationResult validationResult = validateTemplate("91_iscomplete-false.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1032_IscompleteIsTrue.class));
}
@Test
public void validateCnkIsInLocalRange() {
- assertThat(validateTemplate("92_cnk-reserved-for-local-usage.xml"), ValidationMatchers.failsForRule(R1031_CnkNotInLocalRange.class));
+ ValidationResult validationResult = validateTemplate("92_cnk-reserved-for-local-usage.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1031_CnkNotInLocalRange.class));
}
@Test
public void validateCnkWrongControlNumber() {
- assertThat(validateTemplate("93_cnk-wrong-control-number.xml"), ValidationMatchers.failsForRule(R1030_CnkValidControlNumber.class));
+ ValidationResult validationResult = validateTemplate("93_cnk-wrong-control-number.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1030_CnkValidControlNumber.class));
}
@Test
public void validateInnclusterWrongControlNumber() {
- assertThat(validateTemplate("94_inncluster-wrong-control-number.xml"), ValidationMatchers.failsForRule(R1030_CnkValidControlNumber.class));
+ ValidationResult validationResult = validateTemplate("94_inncluster-wrong-control-number.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1030_CnkValidControlNumber.class));
}
@Test
public void validateEndmomentBeforeBeginmoment() {
- assertThat(validateTemplate("95_endmoment-before-beginmoment.xml"), ValidationMatchers.failsForRule(R1033_BeginmomentVsEndmoment.class));
+ ValidationResult validationResult = validateTemplate("95_endmoment-before-beginmoment.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1033_BeginmomentVsEndmoment.class));
}
@Test
public void validateEndmomentEqualsBeginmoment() {
- assertThat(validateTemplate("96_endmoment-equals-beginmoment.xml"), ValidationMatchers.passes(R1033_BeginmomentVsEndmoment.class));
+ ValidationResult validationResult = validateTemplate("96_endmoment-equals-beginmoment.xml");
+ assertThat(validationResult).is(ValidationMatchers.passes(R1033_BeginmomentVsEndmoment.class));
}
@Test
public void validateIsValidatedFalse() {
- assertThat(validateTemplate("97_isvalidated-false.xml"), ValidationMatchers.failsForRule(R1034_IsvalidatedIsTrue.class));
+ ValidationResult validationResult = validateTemplate("97_isvalidated-false.xml");
+ assertThat(validationResult).is(ValidationMatchers.failsForRule(R1034_IsvalidatedIsTrue.class));
}
}
\ No newline at end of file