Fix tests

This commit is contained in:
Antonin Delpeuch 2018-03-18 18:07:28 +00:00
parent 8fab42ce8f
commit 112f3f9308
3 changed files with 5 additions and 5 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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());
}
}