From 989bb2117bbe342f2637eb5acc05ee26c2987176 Mon Sep 17 00:00:00 2001 From: Philipp Dallig Date: Mon, 11 Sep 2023 11:38:50 +0200 Subject: [PATCH] [ZEPPELIN-5950] Migrate sparql to Junit5 (#4644) --- .../zeppelin/sparql/SparqlJenaEngineTest.java | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/sparql/src/test/java/org/apache/zeppelin/sparql/SparqlJenaEngineTest.java b/sparql/src/test/java/org/apache/zeppelin/sparql/SparqlJenaEngineTest.java index 76546149535..84195bbcf15 100644 --- a/sparql/src/test/java/org/apache/zeppelin/sparql/SparqlJenaEngineTest.java +++ b/sparql/src/test/java/org/apache/zeppelin/sparql/SparqlJenaEngineTest.java @@ -17,9 +17,6 @@ package org.apache.zeppelin.sparql; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import org.apache.jena.fuseki.Fuseki; import org.apache.jena.fuseki.main.FusekiServer; import org.apache.jena.fuseki.server.DataAccessPointRegistry; @@ -28,18 +25,19 @@ import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Properties; import org.apache.zeppelin.interpreter.InterpreterResult; import org.apache.zeppelin.interpreter.InterpreterResult.Code; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; - -public class SparqlJenaEngineTest { +class SparqlJenaEngineTest { private static int port; private static FusekiServer server; @@ -52,7 +50,7 @@ public class SparqlJenaEngineTest { private static final String DATA_FILE = "data.ttl"; - @BeforeClass + @BeforeAll public static void setUp() { port = Fuseki.choosePort(); @@ -71,14 +69,14 @@ public static void setUp() { server.start(); } - @AfterClass + @AfterAll public static void tearDown() { if (server != null) { server.stop(); } } - @Before + @BeforeEach public void setUpProperties() { properties = new Properties(); properties.put(SparqlInterpreter.SPARQL_ENGINE_TYPE, ENGINE); @@ -86,7 +84,7 @@ public void setUpProperties() { } @Test - public void testWrongQuery() { + void testWrongQuery() { SparqlInterpreter interpreter = new SparqlInterpreter(properties); interpreter.open(); @@ -95,7 +93,7 @@ public void testWrongQuery() { } @Test - public void testSuccessfulRawQuery() { + void testSuccessfulRawQuery() { properties.put(SparqlInterpreter.SPARQL_REPLACE_URIS, "false"); properties.put(SparqlInterpreter.SPARQL_REMOVE_DATATYPES, "false"); SparqlInterpreter interpreter = new SparqlInterpreter(properties); @@ -128,7 +126,7 @@ public void testSuccessfulRawQuery() { } @Test - public void testSuccessfulReplaceRemoveQuery() { + void testSuccessfulReplaceRemoveQuery() { properties.put(SparqlInterpreter.SPARQL_REPLACE_URIS, "true"); properties.put(SparqlInterpreter.SPARQL_REMOVE_DATATYPES, "true"); SparqlInterpreter interpreter = new SparqlInterpreter(properties); @@ -161,7 +159,7 @@ public void testSuccessfulReplaceRemoveQuery() { } @Test - public void testRemoteEndpoint() { + void testRemoteEndpoint() { properties.put(SparqlInterpreter.SPARQL_SERVICE_ENDPOINT, "http://dbpedia.org/sparql"); SparqlInterpreter interpreter = new SparqlInterpreter(properties); interpreter.open(); @@ -178,7 +176,7 @@ public void testRemoteEndpoint() { } @Test - public void testEndpointMalformed() { + void testEndpointMalformed() { properties.put(SparqlInterpreter.SPARQL_SERVICE_ENDPOINT, "tsohlacol"); SparqlInterpreter interpreter = new SparqlInterpreter(properties); interpreter.open(); @@ -189,7 +187,7 @@ public void testEndpointMalformed() { } @Test - public void testEndpointNotFound() { + void testEndpointNotFound() { properties.put(SparqlInterpreter.SPARQL_SERVICE_ENDPOINT, "http://tsohlacol/"); SparqlInterpreter interpreter = new SparqlInterpreter(properties); interpreter.open();