TSK-560: Changed http status code for successfully deleting a task to 204

This commit is contained in:
julian.schallenmueller 2018-06-06 14:30:50 +02:00 committed by Holger Hagen
parent 3230e35c2c
commit 65dbb8c82c
3 changed files with 6 additions and 6 deletions

View File

@ -354,7 +354,7 @@ public class TaskControllerRestDocumentation {
this.mockMvc.perform(RestDocumentationRequestBuilders
.delete("http://127.0.0.1:" + port + "/v1/tasks/" + newId)
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) //admin
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.status().isNoContent())
.andDo(MockMvcRestDocumentation.document("DeleteTaskDocTest"));
}
@ -386,7 +386,7 @@ public class TaskControllerRestDocumentation {
this.mockMvc.perform(RestDocumentationRequestBuilders
.delete("http://127.0.0.1:" + port + "/v1/tasks/" + newId)
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) //admin
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.status().isNoContent())
.andDo(MockMvcRestDocumentation.document("DeleteTaskDocTest"));
}
@ -417,7 +417,7 @@ public class TaskControllerRestDocumentation {
this.mockMvc.perform(RestDocumentationRequestBuilders
.delete("http://127.0.0.1:" + port + "/v1/tasks/" + newId)
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) //admin
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.status().isNoContent())
.andDo(MockMvcRestDocumentation.document("DeleteTaskDocTest"));
}
@ -447,6 +447,6 @@ public class TaskControllerRestDocumentation {
this.mockMvc.perform(RestDocumentationRequestBuilders
.delete("http://127.0.0.1:" + port + "/v1/tasks/" + newId)
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) //admin
.andExpect(MockMvcResultMatchers.status().isOk());
.andExpect(MockMvcResultMatchers.status().isNoContent());
}
}

View File

@ -353,7 +353,7 @@ public class TaskControllerIntTest {
con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("DELETE");
con.setRequestProperty("Authorization", "Basic YWRtaW46YWRtaW4="); // admin
assertEquals(200, con.getResponseCode());
assertEquals(204, con.getResponseCode());
con.disconnect();
}

View File

@ -163,7 +163,7 @@ public class TaskController extends AbstractPagingController {
public ResponseEntity<TaskResource> deleteTask(@PathVariable String taskId)
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
taskService.forceDeleteTask(taskId);
ResponseEntity<TaskResource> result = new ResponseEntity<>(HttpStatus.OK);
ResponseEntity<TaskResource> result = new ResponseEntity<>(HttpStatus.NO_CONTENT);
return result;
}