From 112f3f93086290eef99c5be0a3da8f95af81a48d Mon Sep 17 00:00:00 2001 From: Antonin Delpeuch Date: Sun, 18 Mar 2018 18:07:28 +0000 Subject: [PATCH] Fix tests --- .../wikidata/commands/PreviewWikibaseSchemaCommand.java | 4 ++-- .../wikidata/commands/SaveWikibaseSchemaCommand.java | 2 +- .../org/openrefine/wikidata/commands/SchemaCommandTest.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/wikidata/src/org/openrefine/wikidata/commands/PreviewWikibaseSchemaCommand.java b/extensions/wikidata/src/org/openrefine/wikidata/commands/PreviewWikibaseSchemaCommand.java index c27b37349..0a1e3d792 100644 --- a/extensions/wikidata/src/org/openrefine/wikidata/commands/PreviewWikibaseSchemaCommand.java +++ b/extensions/wikidata/src/org/openrefine/wikidata/commands/PreviewWikibaseSchemaCommand.java @@ -67,14 +67,14 @@ public class PreviewWikibaseSchemaCommand extends Command { try { schema = WikibaseSchema.reconstruct(jsonString); } catch (JSONException e) { - respondError(response, e.toString()); + respondError(response, "Wikibase schema could not be parsed."); return; } } else { schema = (WikibaseSchema) project.overlayModels.get("wikibaseSchema"); } if (schema == null) { - respondError(response, "No schema provided."); + respondError(response, "No Wikibase schema provided."); return; } diff --git a/extensions/wikidata/src/org/openrefine/wikidata/commands/SaveWikibaseSchemaCommand.java b/extensions/wikidata/src/org/openrefine/wikidata/commands/SaveWikibaseSchemaCommand.java index 3abf66404..9196fcef5 100644 --- a/extensions/wikidata/src/org/openrefine/wikidata/commands/SaveWikibaseSchemaCommand.java +++ b/extensions/wikidata/src/org/openrefine/wikidata/commands/SaveWikibaseSchemaCommand.java @@ -69,7 +69,7 @@ public class SaveWikibaseSchemaCommand extends Command { // We do not use respondException here because this is an expected // exception which happens every time a user tries to save an incomplete // schema - the exception should not be logged. - respondError(response, "Invalid Wikibase schema provided."); + respondError(response, "Wikibase schema could not be parsed."); } catch (Exception e) { // This is an unexpected exception, so we log it. respondException(response, e); diff --git a/extensions/wikidata/tests/src/org/openrefine/wikidata/commands/SchemaCommandTest.java b/extensions/wikidata/tests/src/org/openrefine/wikidata/commands/SchemaCommandTest.java index c4a824623..e85f819c6 100644 --- a/extensions/wikidata/tests/src/org/openrefine/wikidata/commands/SchemaCommandTest.java +++ b/extensions/wikidata/tests/src/org/openrefine/wikidata/commands/SchemaCommandTest.java @@ -39,7 +39,7 @@ public abstract class SchemaCommandTest extends CommandTest { throws ServletException, IOException { command.doPost(request, response); - assertEquals("{\"status\":\"error\",\"message\":\"No Wikibase schema provided.\"}", writer.toString()); + assertEquals("{\"code\":\"error\",\"message\":\"No Wikibase schema provided.\"}", writer.toString()); } @Test @@ -48,6 +48,6 @@ public abstract class SchemaCommandTest extends CommandTest { when(request.getParameter("schema")).thenReturn("{bogus json"); command.doPost(request, response); - assertEquals("{\"status\":\"error\",\"message\":\"Wikibase schema could not be parsed.\"}", writer.toString()); + assertEquals("{\"code\":\"error\",\"message\":\"Wikibase schema could not be parsed.\"}", writer.toString()); } }