Skip to content

Commit

Permalink
Update Junit to Jupiter 5.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
julesjacobsen committed Nov 7, 2023
1 parent 2d309bc commit 4c30db1
Show file tree
Hide file tree
Showing 21 changed files with 66 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
import org.geneontology.obographs.core.model.*;
import org.geneontology.obographs.core.model.meta.SynonymPropertyValue;
import org.geneontology.obographs.core.model.meta.XrefPropertyValue;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;

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

public class OgJsonGeneratorTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.geneontology.obographs.core.model.GraphDocument;
import org.geneontology.obographs.core.model.Node;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.geneontology.obographs.core.io;

import org.apache.commons.io.FileUtils;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;

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

public class OgProtobufGeneratorTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.geneontology.obographs.core.model.Graph;
import org.geneontology.obographs.core.model.GraphDocument;
import org.geneontology.obographs.core.model.Meta;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.geneontology.obographs.core.model;

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

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

public class EdgeTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import org.geneontology.obographs.core.io.OgJsonGenerator;
import org.geneontology.obographs.core.io.OgYamlGenerator;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

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

public class GraphDocumentTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import org.geneontology.obographs.core.io.OgJsonGenerator;
import org.geneontology.obographs.core.io.OgYamlGenerator;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

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

public class GraphTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package org.geneontology.obographs.core.model;

import org.geneontology.obographs.core.model.meta.*;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.Collections;

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

public class MetaTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.geneontology.obographs.core.model;

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

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

public class NodeTest {

Expand Down Expand Up @@ -37,4 +39,13 @@ public static Node buildParent() {
return new Node.Builder().id(parent_id).label(parent_lbl).build();
}

@Test
public void testComparator() {
Node aa = new Node.Builder().id("a").label("a").build();
Node ab = new Node.Builder().id("a").label("b").build();

assertThat(aa.compareTo(ab), equalTo(-1));
assertThat(aa.compareTo(aa), equalTo(0));
assertThat(ab.compareTo(aa), equalTo(1));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import org.geneontology.obographs.core.io.OgJsonGenerator;
import org.geneontology.obographs.core.io.OgYamlGenerator;
import org.geneontology.obographs.core.model.*;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

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

public class AdvancedAxiomsTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.geneontology.obographs.core.model.axiom;

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

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

public class DomainRangeAxiomTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package org.geneontology.obographs.core.model.axiom;

import com.fasterxml.jackson.core.JsonProcessingException;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

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

public class EquivalentNodesSetTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.geneontology.obographs.core.model.axiom;

import com.fasterxml.jackson.core.JsonProcessingException;
import org.junit.Test;
import org.junit.jupiter.api.Test;

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

public class ExistentialRestrictionAxiomTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package org.geneontology.obographs.core.model.axiom;

import com.fasterxml.jackson.core.JsonProcessingException;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

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

public class LogicalDefinitionAxiomTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.geneontology.obographs.core.model.axiom;

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

import java.util.ArrayList;
import java.util.List;

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

public class PropertyChainAxiomTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.geneontology.obographs.core.model.meta;

import org.geneontology.obographs.core.model.meta.AbstractSynonymPropertyValue.SCOPES;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.Arrays;

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

public class SynonymPropertyValueTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.geneontology.obographs.core.model.meta;

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

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

public class XrefPropertyValueTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.geneontology.obographs.core.io.OgJsonGenerator;
import org.geneontology.obographs.core.io.OgYamlGenerator;
import org.geneontology.obographs.core.model.GraphDocument;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLOntology;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.geneontology.obographs.core.model.*;
import org.geneontology.obographs.core.model.AbstractNode.PropertyType;
import org.geneontology.obographs.core.model.meta.BasicPropertyValue;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLOntology;
Expand All @@ -28,8 +28,8 @@

import static org.geneontology.obographs.core.model.AbstractNode.RDFTYPES.*;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.fail;

/**
* Generates json from OWL and tests the content returned for equality.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package org.geneontology.obographs.owlapi;

import com.github.jsonldjava.core.Context;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.semanticweb.owlapi.util.DefaultPrefixManager;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

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

public class PrefixHelperTest {

Expand All @@ -22,9 +22,9 @@ public void testContext() throws IOException {
PrefixHelper ioh = new PrefixHelper();
Context context = ioh.getContext();

assertEquals("Check GO prefix",
assertEquals(
"http://purl.obolibrary.org/obo/GO_",
context.getPrefixes(false).get("GO"));
context.getPrefixes(false).get("GO"), "Check GO prefix");
}

/**
Expand All @@ -51,7 +51,7 @@ public void testContextHandling() throws IOException {
Map<String, String> expected = new HashMap<String, String>();
expected.put("foo", "http://example.com#");
expected.put("bar", "http://example.com#");
assertEquals("Check JSON prefixes", expected, ioh.getPrefixes());
assertEquals(expected, ioh.getPrefixes(), "Check JSON prefixes");
}

/**
Expand All @@ -63,22 +63,22 @@ public void testContextHandling() throws IOException {
public void testPrefixHandling() throws IOException {
PrefixHelper ioh = new PrefixHelper(false);
Map<String, String> expected = new HashMap<String, String>();
assertEquals("Check no prefixes", expected, ioh.getPrefixes());
assertEquals(expected, ioh.getPrefixes(), "Check no prefixes");

ioh.addPrefix("foo", "http://example.com#");
expected.put("foo", "http://example.com#");
assertEquals("Check foo prefix", expected, ioh.getPrefixes());
assertEquals(expected, ioh.getPrefixes(), "Check foo prefix");

String json = String.format("{%n"
+ " \"@context\" : {%n"
+ " \"foo\" : \"http://example.com#\"%n"
+ " }%n"
+ "}");
assertEquals("Check JSON-LD", json, ioh.getContextString());
assertEquals(json, ioh.getContextString(), "Check JSON-LD");

ioh.addPrefix("bar: http://example.com#");
expected.put("bar", "http://example.com#");
assertEquals("Check no prefixes", expected, ioh.getPrefixes());
assertEquals(expected, ioh.getPrefixes(), "Check no prefixes");
}

/**
Expand All @@ -91,9 +91,9 @@ public void testPrefixManager() throws IOException {
PrefixHelper ioh = new PrefixHelper();
DefaultPrefixManager pm = ioh.getPrefixManager();

assertEquals("Check GO CURIE",
"http://purl.obolibrary.org/obo/GO_12345",
pm.getIRI("GO:12345").toString());
assertEquals("http://purl.obolibrary.org/obo/GO_12345",
pm.getIRI("GO:12345").toString(),
"Check GO CURIE");
}

}
7 changes: 4 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>
<jackson.version>2.12.7</jackson.version>
<junit.jupiter.version>5.3.0</junit.jupiter.version>
</properties>

<distributionManagement>
Expand Down Expand Up @@ -164,9 +165,9 @@
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down

0 comments on commit 4c30db1

Please sign in to comment.