Exercise 8 PR #95
| @@ -45,8 +45,8 @@ public class ApplyForTaskWebController { | |||||||
|  |  | ||||||
|         try { |         try { | ||||||
|  |  | ||||||
|             String executorType = command.getTaskType().toString(); |             String executorType = command.getTaskType().getValue().toString(); | ||||||
|             String executorURI = command.getExecutorURI().toString(); |             String executorURI = command.getExecutorURI().getValue().toString(); | ||||||
|  |  | ||||||
|             String jsonPayLoad = new JSONObject() |             String jsonPayLoad = new JSONObject() | ||||||
|                 .put("executorType", executorType) |                 .put("executorType", executorType) | ||||||
| @@ -56,7 +56,7 @@ public class ApplyForTaskWebController { | |||||||
|             HttpHeaders responseHeaders = new HttpHeaders(); |             HttpHeaders responseHeaders = new HttpHeaders(); | ||||||
|             responseHeaders.add("Content-Type", "application/json"); |             responseHeaders.add("Content-Type", "application/json"); | ||||||
|  |  | ||||||
|             return new ResponseEntity<>(jsonPayLoad, responseHeaders, HttpStatus.OK); |             return new ResponseEntity<>(jsonPayLoad, responseHeaders, HttpStatus.CREATED); | ||||||
|         } catch (ConstraintViolationException e) { |         } catch (ConstraintViolationException e) { | ||||||
|             throw new ResponseStatusException(HttpStatus.BAD_REQUEST, e.getMessage()); |             throw new ResponseStatusException(HttpStatus.BAD_REQUEST, e.getMessage()); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -35,14 +35,12 @@ public class AddNewAssignmentToRosterServiceSystemTest { | |||||||
|         ResponseEntity response = whenAddNewAssignmentToRoster(rosterItemId, executorType, executorURI); |         ResponseEntity response = whenAddNewAssignmentToRoster(rosterItemId, executorType, executorURI); | ||||||
|  |  | ||||||
|         System.out.println(response.getBody().toString()); |         System.out.println(response.getBody().toString()); | ||||||
|         response.getBody(). |  | ||||||
|         JSONObject responseJson = new JSONObject(response.getBody().toString()); |         JSONObject responseJson = new JSONObject(response.getBody().toString()); | ||||||
|         String respRosterItemId = responseJson.getString("rosterItemId"); |  | ||||||
|         String respExecutorType = responseJson.getString("executorType"); |         String respExecutorType = responseJson.getString("executorType"); | ||||||
|         String respExecutorURI = responseJson.getString("executorURI"); |         String respExecutorURI = responseJson.getString("executorURI"); | ||||||
|  |  | ||||||
|         then(response.getStatusCode()).isEqualTo(HttpStatus.CREATED); |         then(response.getStatusCode()).isEqualTo(HttpStatus.CREATED); | ||||||
|         then(respRosterItemId).isEqualTo(rosterItemId); |  | ||||||
|         then(respExecutorType).isEqualTo(executorType); |         then(respExecutorType).isEqualTo(executorType); | ||||||
|         then(respExecutorURI).isEqualTo(executorURI); |         then(respExecutorURI).isEqualTo(executorURI); | ||||||
|         then(Roster.getInstance().getRosterMap().size()).isEqualTo(1); |         then(Roster.getInstance().getRosterMap().size()).isEqualTo(1); | ||||||
|   | |||||||
| @@ -61,7 +61,6 @@ public class ApplyForTaskWebControllerTest { | |||||||
|             .content(jsonPayLoad)) |             .content(jsonPayLoad)) | ||||||
|             .andExpect(status().is2xxSuccessful()); |             .andExpect(status().is2xxSuccessful()); | ||||||
|  |  | ||||||
|         //TODO: No idea why this does not work yet |  | ||||||
|         then(applyForTaskUseCase).should() |         then(applyForTaskUseCase).should() | ||||||
|             .applyForTask(new ApplyForTaskCommand(new ExecutorType(executorType), new ExecutorURI(executorURI))); |             .applyForTask(new ApplyForTaskCommand(new ExecutorType(executorType), new ExecutorURI(executorURI))); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user