diff --git a/compliance/manager/pom.xml b/compliance/manager/pom.xml
index f195109d809..04174a291dd 100644
--- a/compliance/manager/pom.xml
+++ b/compliance/manager/pom.xml
@@ -43,5 +43,10 @@
junit
test
+
+ org.assertj
+ assertj-core
+ test
+
diff --git a/compliance/manager/src/test/java/org/eclipse/rdf4j/repository/manager/LocalRepositoryManagerTest.java b/compliance/manager/src/test/java/org/eclipse/rdf4j/repository/manager/LocalRepositoryManagerTest.java
index f54df4e1581..a3a7d395944 100644
--- a/compliance/manager/src/test/java/org/eclipse/rdf4j/repository/manager/LocalRepositoryManagerTest.java
+++ b/compliance/manager/src/test/java/org/eclipse/rdf4j/repository/manager/LocalRepositoryManagerTest.java
@@ -7,12 +7,10 @@
*******************************************************************************/
package org.eclipse.rdf4j.repository.manager;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsEqual.equalTo;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.io.File;
@@ -88,7 +86,7 @@ public void tearDown()
/**
* Test method for
* {@link org.eclipse.rdf4j.repository.manager.LocalRepositoryManager#getRepository(java.lang.String)} .
- *
+ *
* @throws RepositoryException
* if a problem occurs accessing the repository
* @throws RepositoryConfigException
@@ -181,7 +179,7 @@ public void testRestartManagerWithTransaction()
/**
* Test method for {@link RepositoryManager.isSafeToRemove(String)}.
- *
+ *
* @throws RepositoryException
* if a problem occurs during execution
* @throws RepositoryConfigException
@@ -191,11 +189,11 @@ public void testRestartManagerWithTransaction()
public void testIsSafeToRemove()
throws RepositoryException, RepositoryConfigException
{
- assertThat(manager.isSafeToRemove(PROXY_ID), is(equalTo(true)));
- assertThat(manager.isSafeToRemove(TEST_REPO), is(equalTo(false)));
+ assertThat(manager.isSafeToRemove(PROXY_ID)).isTrue();
+ assertThat(manager.isSafeToRemove(TEST_REPO)).isFalse();
manager.removeRepository(PROXY_ID);
- assertThat(manager.hasRepositoryConfig(PROXY_ID), is(equalTo(false)));
- assertThat(manager.isSafeToRemove(TEST_REPO), is(equalTo(true)));
+ assertThat(manager.hasRepositoryConfig(PROXY_ID)).isFalse();;
+ assertThat(manager.isSafeToRemove(TEST_REPO)).isTrue();;
}
@Test
diff --git a/pom.xml b/pom.xml
index 3983f7ee505..60b054bc31b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -508,9 +508,9 @@
test
- org.hamcrest
- hamcrest-library
- 1.3
+ org.assertj
+ assertj-core
+ 3.9.1
test
diff --git a/rio/api/pom.xml b/rio/api/pom.xml
index 857e0a63bd2..bce8c567526 100644
--- a/rio/api/pom.xml
+++ b/rio/api/pom.xml
@@ -29,8 +29,8 @@
junit
- org.hamcrest
- hamcrest-library
+ org.assertj
+ assertj-core
test
diff --git a/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/RioFileTypeDetectorTest.java b/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/RioFileTypeDetectorTest.java
index 2adaeadee64..3d4fcf47194 100644
--- a/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/RioFileTypeDetectorTest.java
+++ b/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/RioFileTypeDetectorTest.java
@@ -7,20 +7,18 @@
*******************************************************************************/
package org.eclipse.rdf4j.rio.helpers;
-import static org.hamcrest.Matchers.hasItem;
-import static org.hamcrest.Matchers.isA;
-import static org.junit.Assert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
import java.nio.file.spi.FileTypeDetector;
import java.util.ServiceLoader;
import org.junit.Test;
-public class RioFileTypeDetectorTest {
+public class RioFileTypeDetectorTest
+{
@Test
public void correctClassIsRegisteredInServices()
{
- assertThat(ServiceLoader.load(FileTypeDetector.class),
- hasItem(isA(RioFileTypeDetector.class)));
+ assertThat(ServiceLoader.load(FileTypeDetector.class)).anyMatch(ftd -> ftd instanceof RioFileTypeDetector);
}
}
diff --git a/rio/rdfxml/pom.xml b/rio/rdfxml/pom.xml
index b5218b56a67..d5b257f5e1a 100644
--- a/rio/rdfxml/pom.xml
+++ b/rio/rdfxml/pom.xml
@@ -52,8 +52,8 @@
test
- org.hamcrest
- hamcrest-library
+ org.assertj
+ assertj-core
test
diff --git a/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLParserTest.java b/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLParserTest.java
index a14ecbc6ab0..0069da12b71 100644
--- a/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLParserTest.java
+++ b/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLParserTest.java
@@ -7,9 +7,9 @@
*******************************************************************************/
package org.eclipse.rdf4j.rio.rdfxml;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayOutputStream;
@@ -30,8 +30,6 @@
import org.eclipse.rdf4j.rio.RDFParser;
import org.eclipse.rdf4j.rio.helpers.ParseErrorCollector;
import org.eclipse.rdf4j.rio.helpers.StatementCollector;
-import org.hamcrest.CoreMatchers;
-import org.hamcrest.Matchers;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -53,7 +51,7 @@ public void setUp()
throws Exception
{
platformLocale = Locale.getDefault();
-
+
Locale.setDefault(Locale.ENGLISH);
vf = SimpleValueFactory.getInstance();
parser = new RDFXMLParser();
@@ -87,7 +85,7 @@ public void rdfXmlLoadedFromInsideAJarResolvesRelativeUris()
Collection stmts = sc.getStatements();
- assertThat(stmts, Matchers. iterableWithSize(3));
+ assertThat(stmts).hasSize(3);
Iterator iter = stmts.iterator();
@@ -102,7 +100,7 @@ public void rdfXmlLoadedFromInsideAJarResolvesRelativeUris()
String resourceUrl = res.stringValue();
- assertThat(resourceUrl, CoreMatchers.startsWith("jar:" + zipfileUrl + "!"));
+ assertThat(resourceUrl).startsWith("jar:" + zipfileUrl + "!");
URL javaUrl = new URL(resourceUrl);
assertEquals("jar", javaUrl.getProtocol());
diff --git a/rio/trix/pom.xml b/rio/trix/pom.xml
index a9cbc10ab52..b661cc0bd2d 100644
--- a/rio/trix/pom.xml
+++ b/rio/trix/pom.xml
@@ -50,10 +50,5 @@
junit
test
-
- org.hamcrest
- hamcrest-library
- test
-
diff --git a/rio/turtle/pom.xml b/rio/turtle/pom.xml
index 9e3243abcbf..748b0a8a851 100644
--- a/rio/turtle/pom.xml
+++ b/rio/turtle/pom.xml
@@ -52,8 +52,8 @@
test
- org.hamcrest
- hamcrest-library
+ org.assertj
+ assertj-core
test
diff --git a/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TestTurtleParser.java b/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TestTurtleParser.java
index f601cd706d9..1cc78380089 100644
--- a/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TestTurtleParser.java
+++ b/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TestTurtleParser.java
@@ -7,13 +7,10 @@
*******************************************************************************/
package org.eclipse.rdf4j.rio.turtle;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.Matchers.empty;
-import static org.hamcrest.Matchers.hasSize;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -35,8 +32,6 @@
import org.eclipse.rdf4j.rio.helpers.ParseErrorCollector;
import org.eclipse.rdf4j.rio.helpers.SimpleParseLocationListener;
import org.eclipse.rdf4j.rio.helpers.StatementCollector;
-import org.hamcrest.CoreMatchers;
-import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
@@ -116,11 +111,11 @@ public void testParseIllegalURINonFatal()
parser.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_URI_SYNTAX);
parser.parse(new StringReader(data), baseURI);
- assertThat(errorCollector.getErrors(), hasSize(1));
- assertThat(errorCollector.getFatalErrors(), empty());
- assertThat(statementCollector.getStatements(), not(empty()));
- assertThat("only syntactically legal triples should have been reported",
- statementCollector.getStatements(), hasSize(1));
+ assertThat(errorCollector.getErrors()).hasSize(1);
+ assertThat(errorCollector.getFatalErrors()).isEmpty();
+ assertThat(statementCollector.getStatements()).isNotEmpty();
+ assertThat(statementCollector.getStatements()).hasSize(1)
+ .overridingErrorMessage("only syntactically legal triples should have been reported");
}
@Test
@@ -132,10 +127,11 @@ public void testParseIllegalURINoVerify()
parser.getParserConfig().set(BasicParserSettings.VERIFY_URI_SYNTAX, false);
parser.parse(new StringReader(data), baseURI);
- assertThat(errorCollector.getErrors(), empty());
- assertThat(errorCollector.getFatalErrors(), empty());
- assertThat(statementCollector.getStatements(), not(empty()));
- assertThat("all triples should have been reported", statementCollector.getStatements(), hasSize(3));
+ assertThat(errorCollector.getErrors()).isEmpty();
+ assertThat(errorCollector.getFatalErrors()).isEmpty();
+ assertThat(statementCollector.getStatements()).isNotEmpty();
+ assertThat(statementCollector.getStatements()).hasSize(3)
+ .overridingErrorMessage("all triples should have been reported");
}
@Test
@@ -360,7 +356,7 @@ public void rdfXmlLoadedFromInsideAJarResolvesRelativeUris()
Collection stmts = sc.getStatements();
- assertThat(stmts, Matchers. iterableWithSize(2));
+ assertThat(stmts).hasSize(2);
Iterator iter = stmts.iterator();
@@ -373,7 +369,7 @@ public void rdfXmlLoadedFromInsideAJarResolvesRelativeUris()
String resourceUrl = res.stringValue();
- assertThat(resourceUrl, CoreMatchers.startsWith("jar:" + zipfileUrl + "!"));
+ assertThat(resourceUrl).startsWith("jar:" + zipfileUrl + "!");
URL javaUrl = new URL(resourceUrl);
assertEquals("jar", javaUrl.getProtocol());