Skip to content

Commit

Permalink
[feature] Update tests from JUnit 4 to JUnit 5
Browse files Browse the repository at this point in the history
  • Loading branch information
adamretter authored and marmoure committed Oct 16, 2023
1 parent dff3e0a commit 354df7e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 19 deletions.
26 changes: 23 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<slf4j.version>2.0.7</slf4j.version>
<jaxb2-basics.version>0.13.1</jaxb2-basics.version>
<eclipse.persistence.version>2.7.10</eclipse.persistence.version>
<junit.jupiter.version>5.9.3</junit.jupiter.version>
<project.build.source>1.8</project.build.source>
<project.build.target>1.8</project.build.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -179,9 +180,15 @@
</dependency> <!-- log4j is provided by Oxygen -->

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -291,6 +298,7 @@
<ignoredUnusedDeclaredDependency>org.glassfish.jersey.inject:jersey-hk2</ignoredUnusedDeclaredDependency>
<ignoredUnusedDeclaredDependency>org.glassfish:javax.json</ignoredUnusedDeclaredDependency>
<ignoredUnusedDeclaredDependency>com.sun.xml.bind:jaxb-impl</ignoredUnusedDeclaredDependency>
<ignoredUnusedDeclaredDependency>org.junit.jupiter:junit-jupiter-engine</ignoredUnusedDeclaredDependency>
</ignoredUnusedDeclaredDependencies>
<ignoredNonTestScopedDependencies>
<ignoredNonTestScopedDependency>jakarta.annotation:jakarta.annotation-api</ignoredNonTestScopedDependency>
Expand Down Expand Up @@ -326,6 +334,18 @@
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@

import static com.evolvedbinary.xpath.parser.ast.QNameW.WILDCARD;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* @author Adam Retter, Evolved Binary Ltd
Expand Down Expand Up @@ -66,14 +67,18 @@ public void isSubset() {
// assertTrue(XPathUtil.isSubset("/TEI/text[1]/body[1]/p[2]/w[7]/@lemma", "//w"));
}

@Test(expected = IllegalArgumentException.class)
@Test
public void isSubset_illegalSubset() {
XPathUtil.isSubset("a/b", "//a");
assertThrows(IllegalArgumentException.class, () ->
XPathUtil.isSubset("a/b", "//a")
);
}

@Test(expected = IllegalArgumentException.class)
@Test
public void isSubset_illegalSuperset() {
XPathUtil.isSubset("//a", "a/b");
assertThrows(IllegalArgumentException.class, () ->
XPathUtil.isSubset("//a", "a/b")
);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import org.humanistika.oxygen.tei.completer.configuration.beans.ResponseAction;
import org.humanistika.oxygen.tei.completer.remote.ClientFactory.AuthenticationType;
import javax.annotation.Nullable;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import javax.annotation.security.PermitAll;
import javax.annotation.security.RolesAllowed;
Expand All @@ -53,7 +53,7 @@
import java.security.Principal;
import java.util.zip.GZIPOutputStream;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* Integration tests for {@link org.humanistika.oxygen.tei.completer.remote.impl.JerseyClient}
Expand Down Expand Up @@ -492,7 +492,7 @@ public void secure_preemptiveBasic_GetLemmaSelectionDependent_Xml() {
assertEquals(expectedSuggestions.getSuggestion(), suggestions.getSuggestion());
}

@Ignore("Requires non-preemptive support in Jersey Server. See https://java.net/jira/browse/JERSEY-2908")
@Disabled("Requires non-preemptive support in Jersey Server. See https://java.net/jira/browse/JERSEY-2908")
@Test
public void secure_nonPreemptiveBasic_GetLemmaSelection_Xml() {
final String selection = "some-selection";
Expand All @@ -507,7 +507,7 @@ public void secure_nonPreemptiveBasic_GetLemmaSelection_Xml() {
assertEquals(expectedSuggestions.getSuggestion(), suggestions.getSuggestion());
}

@Ignore("Requires non-preemptive support in Jersey Server. See https://java.net/jira/browse/JERSEY-2908")
@Disabled("Requires non-preemptive support in Jersey Server. See https://java.net/jira/browse/JERSEY-2908")
@Test
public void secure_nonPreemptiveBasic_GetLemmaSelectionDependent_Xml() {
final String selection = "some-selection";
Expand All @@ -522,7 +522,7 @@ public void secure_nonPreemptiveBasic_GetLemmaSelectionDependent_Xml() {
assertEquals(expectedSuggestions.getSuggestion(), suggestions.getSuggestion());
}

@Ignore("Requires non-preemptive support in Jersey Server. See https://java.net/jira/browse/JERSEY-2908")
@Disabled("Requires non-preemptive support in Jersey Server. See https://java.net/jira/browse/JERSEY-2908")
@Test
public void secure_Digest_GetLemmaSelection_Xml() {
final String selection = "some-selection";
Expand All @@ -537,7 +537,7 @@ public void secure_Digest_GetLemmaSelection_Xml() {
assertEquals(expectedSuggestions.getSuggestion(), suggestions.getSuggestion());
}

@Ignore("Requires non-preemptive support in Jersey Server. See https://java.net/jira/browse/JERSEY-2908")
@Disabled("Requires non-preemptive support in Jersey Server. See https://java.net/jira/browse/JERSEY-2908")
@Test
public void secure_Digest_GetLemmaSelectionDependent_Xml() {
final String selection = "some-selection";
Expand All @@ -552,7 +552,7 @@ public void secure_Digest_GetLemmaSelectionDependent_Xml() {
assertEquals(expectedSuggestions.getSuggestion(), suggestions.getSuggestion());
}

@Ignore("Requires non-preemptive support in Jersey Server. See https://java.net/jira/browse/JERSEY-2908")
@Disabled("Requires non-preemptive support in Jersey Server. See https://java.net/jira/browse/JERSEY-2908")
@Test
public void secure_nonPreemptiveBasicDigest_GetLemmaSelection_Xml() {
final String selection = "some-selection";
Expand All @@ -567,7 +567,7 @@ public void secure_nonPreemptiveBasicDigest_GetLemmaSelection_Xml() {
assertEquals(expectedSuggestions.getSuggestion(), suggestions.getSuggestion());
}

@Ignore("Requires non-preemptive support in Jersey Server. See https://java.net/jira/browse/JERSEY-2908")
@Disabled("Requires non-preemptive support in Jersey Server. See https://java.net/jira/browse/JERSEY-2908")
@Test
public void secure_nonPreemptiveBasicDigest_GetLemmaSelectionDependent_Xml() {
final String selection = "some-selection";
Expand Down

0 comments on commit 354df7e

Please sign in to comment.