fixed most of the tests
This commit is contained in:
@@ -3,6 +3,8 @@ package ch.unisg.roster.roster;
|
||||
|
||||
import ch.unisg.roster.roster.application.port.in.AddRosterItemPort;
|
||||
import ch.unisg.roster.roster.domain.Roster;
|
||||
import ch.unisg.roster.roster.domain.Task;
|
||||
import ch.unisg.roster.roster.domain.valueobject.ExecutorType;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -28,10 +30,12 @@ public class AddNewAssignmentToRosterServiceSystemTest {
|
||||
|
||||
String rosterItemId = "TEST-ID";
|
||||
String executorType = "TEST-TYPE";
|
||||
String executorURI = "http://localhost:6969";
|
||||
String executorURI = "TEST-URI";
|
||||
|
||||
ResponseEntity response = whenAddNewAssignmentToRoster(rosterItemId, executorType, executorURI);
|
||||
|
||||
System.out.println(response.getBody().toString());
|
||||
response.getBody().
|
||||
JSONObject responseJson = new JSONObject(response.getBody().toString());
|
||||
String respRosterItemId = responseJson.getString("rosterItemId");
|
||||
String respExecutorType = responseJson.getString("executorType");
|
||||
@@ -51,7 +55,10 @@ public class AddNewAssignmentToRosterServiceSystemTest {
|
||||
String executorType,
|
||||
String executorURI) throws JSONException {
|
||||
|
||||
Roster.getInstance().getRosterMap().clear();
|
||||
Roster roster = Roster.getInstance();
|
||||
roster.getRosterMap().clear();
|
||||
roster.addTaskToQueue(new Task(rosterItemId, new ExecutorType(executorType), executorURI));
|
||||
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("Content-Type", "application/json");
|
||||
|
@@ -5,7 +5,6 @@ import ch.unisg.common.valueobject.ExecutorURI;
|
||||
import ch.unisg.roster.roster.adapter.out.persistence.mongodb.RosterRepository;
|
||||
import ch.unisg.roster.roster.application.port.in.ApplyForTaskCommand;
|
||||
import ch.unisg.roster.roster.application.port.in.ApplyForTaskUseCase;
|
||||
import ch.unisg.roster.roster.domain.ExecutorInfo;
|
||||
import ch.unisg.roster.roster.domain.RosterItem;
|
||||
import ch.unisg.roster.roster.domain.Task;
|
||||
import ch.unisg.roster.roster.domain.valueobject.ExecutorType;
|
||||
@@ -21,8 +20,8 @@ import static org.mockito.BDDMockito.then;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
@WebMvcTest(controllers = ApplyForTaskController.class)
|
||||
public class ApplyForTaskControllerTest {
|
||||
@WebMvcTest(controllers = ApplyForTaskWebController.class)
|
||||
public class ApplyForTaskWebControllerTest {
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
Reference in New Issue
Block a user