mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-02-09 22:34:42 +00:00
Use assertj instead of hamcrest (#1662)
* Use assertj instead of hamcrest * Trim README
This commit is contained in:
parent
c631f6c808
commit
9b437438ca
@ -282,4 +282,3 @@ This project is maintained by [Grahame Grieve][Link-grahameGithub], [James Agnew
|
|||||||
[Badge-cliSonatypeSnapshot]: https://img.shields.io/nexus/s/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.validation.cli.svg "Sonatype Snapshots"
|
[Badge-cliSonatypeSnapshot]: https://img.shields.io/nexus/s/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.validation.cli.svg "Sonatype Snapshots"
|
||||||
[Badge-validationSonatypeRelease]: https://img.shields.io/nexus/r/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.validation.svg "Sonatype Releases"
|
[Badge-validationSonatypeRelease]: https://img.shields.io/nexus/r/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.validation.svg "Sonatype Releases"
|
||||||
[Badge-validationSonatypeSnapshot]: https://img.shields.io/nexus/s/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.validation.svg "Sonatype Snapshots"
|
[Badge-validationSonatypeSnapshot]: https://img.shields.io/nexus/s/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.validation.svg "Sonatype Snapshots"
|
||||||
|
|
||||||
|
@ -161,6 +161,13 @@
|
|||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.assertj</groupId>
|
||||||
|
<artifactId>assertj-core</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockftpserver</groupId>
|
<groupId>org.mockftpserver</groupId>
|
||||||
<artifactId>MockFtpServer</artifactId>
|
<artifactId>MockFtpServer</artifactId>
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.hl7.fhir.utilities;
|
package org.hl7.fhir.utilities;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.containsString;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
@ -29,7 +28,7 @@ public class FileFormatTest {
|
|||||||
if (Charset.defaultCharset().equals(StandardCharsets.UTF_8)) {
|
if (Charset.defaultCharset().equals(StandardCharsets.UTF_8)) {
|
||||||
assertEquals(0, allWrittenLines.length());
|
assertEquals(0, allWrittenLines.length());
|
||||||
} else {
|
} else {
|
||||||
assertThat(allWrittenLines, containsString("WARNING"));
|
assertThat(allWrittenLines).contains("WARNING");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.hl7.fhir.utilities.i18n;
|
package org.hl7.fhir.utilities.i18n;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.containsString;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
@ -67,11 +66,11 @@ class I18nBaseTest {
|
|||||||
|
|
||||||
//Answer value must be of the type {1}
|
//Answer value must be of the type {1}
|
||||||
String resultOne = testClass.formatMessagePlural(1, I18nConstants.QUESTIONNAIRE_QR_ITEM_WRONGTYPE);
|
String resultOne = testClass.formatMessagePlural(1, I18nConstants.QUESTIONNAIRE_QR_ITEM_WRONGTYPE);
|
||||||
assertThat(resultOne, containsString("be of the type"));
|
assertThat(resultOne).contains("be of the type");
|
||||||
|
|
||||||
//Answer value must be one of the {0} types {1}
|
//Answer value must be one of the {0} types {1}
|
||||||
String resultMany = testClass.formatMessagePlural(3, I18nConstants.QUESTIONNAIRE_QR_ITEM_WRONGTYPE);
|
String resultMany = testClass.formatMessagePlural(3, I18nConstants.QUESTIONNAIRE_QR_ITEM_WRONGTYPE);
|
||||||
assertThat(resultMany, containsString("one of the 3 types "));
|
assertThat(resultMany).contains("one of the 3 types ");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,11 +82,11 @@ class I18nBaseTest {
|
|||||||
testClass.setLocale(Locale.GERMAN);
|
testClass.setLocale(Locale.GERMAN);
|
||||||
//Answer value muss vom Typ {0} sein.
|
//Answer value muss vom Typ {0} sein.
|
||||||
String resultOne = testClass.formatMessagePlural(1, I18nConstants.QUESTIONNAIRE_QR_ITEM_WRONGTYPE);
|
String resultOne = testClass.formatMessagePlural(1, I18nConstants.QUESTIONNAIRE_QR_ITEM_WRONGTYPE);
|
||||||
assertThat(resultOne, containsString("muss vom Typ"));
|
assertThat(resultOne).contains("muss vom Typ");
|
||||||
|
|
||||||
//Answer value muss einer der Typen {1} sein
|
//Answer value muss einer der Typen {1} sein
|
||||||
String resultMany = testClass.formatMessagePlural(3, I18nConstants.QUESTIONNAIRE_QR_ITEM_WRONGTYPE);
|
String resultMany = testClass.formatMessagePlural(3, I18nConstants.QUESTIONNAIRE_QR_ITEM_WRONGTYPE);
|
||||||
assertThat(resultMany, containsString("einer der Typen "));
|
assertThat(resultMany).contains("einer der Typen ");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.hl7.fhir.utilities.npm;
|
package org.hl7.fhir.utilities.npm;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.hamcrest.core.StringStartsWith.startsWith;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
|
||||||
@ -149,7 +148,7 @@ public class PackageServerTest {
|
|||||||
private static void assertBasicAuthorization(RecordedRequest packageRequest) {
|
private static void assertBasicAuthorization(RecordedRequest packageRequest) {
|
||||||
String authorizationHeader = packageRequest.getHeader("Authorization");
|
String authorizationHeader = packageRequest.getHeader("Authorization");
|
||||||
|
|
||||||
assertThat(authorizationHeader, startsWith("Basic"));
|
assertThat(authorizationHeader).startsWith("Basic");
|
||||||
byte[] data = Base64.getDecoder().decode(authorizationHeader.substring(6));
|
byte[] data = Base64.getDecoder().decode(authorizationHeader.substring(6));
|
||||||
String authorizationValue = new String(data, StandardCharsets.UTF_8);
|
String authorizationValue = new String(data, StandardCharsets.UTF_8);
|
||||||
String[] authorizationColumns = authorizationValue.split(":");
|
String[] authorizationColumns = authorizationValue.split(":");
|
||||||
@ -161,7 +160,7 @@ public class PackageServerTest {
|
|||||||
private static void assertTokenAuthorization(RecordedRequest packageRequest) {
|
private static void assertTokenAuthorization(RecordedRequest packageRequest) {
|
||||||
String authorizationHeader = packageRequest.getHeader("Authorization");
|
String authorizationHeader = packageRequest.getHeader("Authorization");
|
||||||
|
|
||||||
assertThat(authorizationHeader, startsWith("Bearer"));
|
assertThat(authorizationHeader).startsWith("Bearer");
|
||||||
String token = authorizationHeader.substring(7);
|
String token = authorizationHeader.substring(7);
|
||||||
|
|
||||||
assertEquals(MockPackageServer.DUMMY_TOKEN, token);
|
assertEquals(MockPackageServer.DUMMY_TOKEN, token);
|
||||||
|
@ -248,19 +248,6 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.hamcrest</groupId>
|
|
||||||
<artifactId>hamcrest-library</artifactId>
|
|
||||||
<version>${hamcrest_version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.hamcrest</groupId>
|
|
||||||
<artifactId>hamcrest</artifactId>
|
|
||||||
<version>${hamcrest_version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- /org.hl7.fhir.core test-jar dependencies -->
|
<!-- /org.hl7.fhir.core test-jar dependencies -->
|
||||||
|
|
||||||
|
@ -249,6 +249,12 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.assertj</groupId>
|
||||||
|
<artifactId>assertj-core</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.platform</groupId>
|
<groupId>org.junit.platform</groupId>
|
||||||
<artifactId>junit-platform-launcher</artifactId>
|
<artifactId>junit-platform-launcher</artifactId>
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package org.hl7.fhir.validation;
|
package org.hl7.fhir.validation;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.is;
|
|
||||||
import static org.hamcrest.Matchers.empty;
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.hl7.fhir.validation.cli.utils;
|
package org.hl7.fhir.validation.cli.utils;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -33,6 +32,6 @@ public class ParamsTests {
|
|||||||
java.lang.Error error = Assertions.assertThrows(java.lang.Error.class, () -> {
|
java.lang.Error error = Assertions.assertThrows(java.lang.Error.class, () -> {
|
||||||
CliContext cliContext = Params.loadCliContext(new String[]{"-fhir-settings", "this-does-not-exist.json"});
|
CliContext cliContext = Params.loadCliContext(new String[]{"-fhir-settings", "this-does-not-exist.json"});
|
||||||
});
|
});
|
||||||
assertThat(error.getMessage(), containsString("this-does-not-exist.json"));
|
assertThat(error.getMessage()).contains("this-does-not-exist.json");
|
||||||
}
|
}
|
||||||
}
|
}
|
22
pom.xml
22
pom.xml
@ -314,6 +314,12 @@
|
|||||||
<artifactId>logback-core</artifactId>
|
<artifactId>logback-core</artifactId>
|
||||||
<version>1.2.13</version>
|
<version>1.2.13</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.assertj</groupId>
|
||||||
|
<artifactId>assertj-core</artifactId>
|
||||||
|
<version>3.22.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
@ -398,14 +404,14 @@
|
|||||||
<goals>
|
<goals>
|
||||||
<goal>checkstyle</goal>
|
<goal>checkstyle</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<failsOnError>true</failsOnError>
|
<failsOnError>true</failsOnError>
|
||||||
<suppressionsLocation>${project.basedir}/checkstyle_suppressions.xml</suppressionsLocation>
|
<suppressionsLocation>${project.basedir}/checkstyle_suppressions.xml</suppressionsLocation>
|
||||||
<enableRulesSummary>true</enableRulesSummary>
|
<enableRulesSummary>true</enableRulesSummary>
|
||||||
<enableSeveritySummary>true</enableSeveritySummary>
|
<enableSeveritySummary>true</enableSeveritySummary>
|
||||||
<consoleOutput>true</consoleOutput>
|
<consoleOutput>true</consoleOutput>
|
||||||
<configLocation>${checkstyle_config_location}/checkstyle.xml</configLocation>
|
<configLocation>${checkstyle_config_location}/checkstyle.xml</configLocation>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user