This is an automated email from the ASF dual-hosted git repository.
veithen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ws-axiom.git
The following commit(s) were added to refs/heads/master by this push:
new 3bff6fe5f Modernize the xml-utils tests
3bff6fe5f is described below
commit 3bff6fe5f1bdc0d097c821184a56223e5fd0bc82
Author: Andreas Veithen <[email protected]>
AuthorDate: Sun Dec 17 10:41:38 2023 +0000
Modernize the xml-utils tests
---
components/xml-utils/pom.xml | 9 +++++++--
.../src/test/java/org/apache/axiom/util/xml/NSUtilsTest.java | 4 ++--
.../test/java/org/apache/axiom/util/xml/QNameCacheTest.java | 8 ++++----
.../src/test/java/org/apache/axiom/util/xml/QNameMapTest.java | 10 ++++++----
4 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/components/xml-utils/pom.xml b/components/xml-utils/pom.xml
index 375ff935d..b34009eb5 100644
--- a/components/xml-utils/pom.xml
+++ b/components/xml-utils/pom.xml
@@ -32,8 +32,13 @@
<dependencies>
<dependency>
- <groupId>com.google.truth</groupId>
- <artifactId>truth</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git
a/components/xml-utils/src/test/java/org/apache/axiom/util/xml/NSUtilsTest.java
b/components/xml-utils/src/test/java/org/apache/axiom/util/xml/NSUtilsTest.java
index 4dbe342ef..6f78801e0 100644
---
a/components/xml-utils/src/test/java/org/apache/axiom/util/xml/NSUtilsTest.java
+++
b/components/xml-utils/src/test/java/org/apache/axiom/util/xml/NSUtilsTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.axiom.util.xml;
-import static com.google.common.truth.Truth.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
import java.io.BufferedReader;
import java.io.InputStreamReader;
@@ -26,7 +26,7 @@ import java.nio.charset.StandardCharsets;
import java.util.HashSet;
import java.util.Set;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class NSUtilsTest {
/**
diff --git
a/components/xml-utils/src/test/java/org/apache/axiom/util/xml/QNameCacheTest.java
b/components/xml-utils/src/test/java/org/apache/axiom/util/xml/QNameCacheTest.java
index fd327e8ba..c0b659822 100644
---
a/components/xml-utils/src/test/java/org/apache/axiom/util/xml/QNameCacheTest.java
+++
b/components/xml-utils/src/test/java/org/apache/axiom/util/xml/QNameCacheTest.java
@@ -18,11 +18,11 @@
*/
package org.apache.axiom.util.xml;
-import static com.google.common.truth.Truth.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
import javax.xml.namespace.QName;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class QNameCacheTest {
@Test
@@ -39,13 +39,13 @@ public class QNameCacheTest {
for (int i = 0; i < 2; i++) {
qnames[i] = QNameCache.getQName("urn:test", "test", "p");
}
- assertThat(qnames[1]).isSameInstanceAs(qnames[0]);
+ assertThat(qnames[1]).isSameAs(qnames[0]);
}
@Test
public void testPrefixIsRelevant() {
QName qname1 = QNameCache.getQName("urn:ns2", "foo", "p");
QName qname2 = QNameCache.getQName("urn:ns2", "foo", "");
- assertThat(qname2).isNotSameInstanceAs(qname1);
+ assertThat(qname2).isNotSameAs(qname1);
}
}
diff --git
a/components/xml-utils/src/test/java/org/apache/axiom/util/xml/QNameMapTest.java
b/components/xml-utils/src/test/java/org/apache/axiom/util/xml/QNameMapTest.java
index 440cf5b02..cb43fd180 100644
---
a/components/xml-utils/src/test/java/org/apache/axiom/util/xml/QNameMapTest.java
+++
b/components/xml-utils/src/test/java/org/apache/axiom/util/xml/QNameMapTest.java
@@ -18,11 +18,12 @@
*/
package org.apache.axiom.util.xml;
-import static com.google.common.truth.Truth.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import javax.xml.namespace.QName;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class QNameMapTest {
@Test
@@ -32,9 +33,10 @@ public class QNameMapTest {
assertThat(map.get(null, "name")).isEqualTo("value");
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void testGetWithNullLocalPart() {
- new QNameMap<Object>().get("urn:test", null);
+ assertThrows(
+ IllegalArgumentException.class, () -> new
QNameMap<Object>().get("urn:test", null));
}
@Test