mock Wikidata service (#2412)
This commit is contained in:
parent
fd2460914c
commit
c20dc69294
@ -1,6 +1,6 @@
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
|
||||
|
||||
<suite name="Wikidata extension">
|
||||
<suite name="Wikidata extension" object-factory="org.powermock.modules.testng.PowerMockObjectFactory">
|
||||
<test name="tests">
|
||||
<groups>
|
||||
<run>
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -31,6 +31,11 @@ import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
import org.openrefine.wikidata.qa.EditInspector;
|
||||
import org.openrefine.wikidata.qa.WikidataConstraintFetcher;
|
||||
import org.openrefine.wikidata.utils.EntityCacheStub;
|
||||
import org.powermock.api.mockito.PowerMockito;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@ -38,6 +43,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.google.refine.util.ParsingUtilities;
|
||||
|
||||
@PrepareForTest(EditInspector.class)
|
||||
public class PreviewWikibaseSchemaCommandTest extends SchemaCommandTest {
|
||||
|
||||
@BeforeMethod
|
||||
@ -46,8 +52,10 @@ public class PreviewWikibaseSchemaCommandTest extends SchemaCommandTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidSchema()
|
||||
throws IOException, ServletException {
|
||||
public void testValidSchema() throws Exception {
|
||||
WikidataConstraintFetcher fetcher = new WikidataConstraintFetcher(new EntityCacheStub());
|
||||
PowerMockito.whenNew(WikidataConstraintFetcher.class).withAnyArguments().thenReturn(fetcher);
|
||||
|
||||
String schemaJson = jsonFromFile("schema/inception.json").toString();
|
||||
when(request.getParameter("schema")).thenReturn(schemaJson);
|
||||
|
||||
|
@ -7,6 +7,7 @@ import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.powermock.modules.testng.PowerMockTestCase;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
@ -21,7 +22,7 @@ import com.google.refine.importing.ImportingJob;
|
||||
import com.google.refine.importing.ImportingManager;
|
||||
import com.google.refine.model.Project;
|
||||
|
||||
public class WikidataRefineTest {
|
||||
public class WikidataRefineTest extends PowerMockTestCase {
|
||||
protected File workspaceDir;
|
||||
protected RefineServlet servlet;
|
||||
private List<Project> projects = new ArrayList<Project>();
|
||||
|
Loading…
Reference in New Issue
Block a user