Fixed some roster tests

This commit is contained in:
reynisson
2021-11-26 14:48:49 +01:00
parent 2f36e01c57
commit 49977ae8a2
6 changed files with 34 additions and 27 deletions

View File

@@ -28,7 +28,7 @@ public class AddNewAssignmentToRosterServiceSystemTest {
String rosterItemId = "TEST-ID";
String executorType = "TEST-TYPE";
String executorURI = "TEST-URI";
String executorURI = "http://localhost:6969";
ResponseEntity response = whenAddNewAssignmentToRoster(rosterItemId, executorType, executorURI);

View File

@@ -37,12 +37,12 @@ public class ApplyForTaskControllerTest {
void testApplyForTask() throws Exception{
String executorType = "TEST-TYPE";
String executorURI = "TEST-URI";
String executorURI = "http://localhost:6969";
String taskId = "TEST-ID";
String jsonPayLoad = new JSONObject()
.put("executorType", executorType )
.put("executorUri",executorURI)
.put("executorURI",executorURI)
.toString();
RosterItem rosterItem = new RosterItem(taskId, executorType,
@@ -60,7 +60,7 @@ public class ApplyForTaskControllerTest {
mockMvc.perform(post("/task/apply/")
.contentType("application/json")
.content(jsonPayLoad))
.andExpect(status().isCreated());
.andExpect(status().is2xxSuccessful());
//TODO: No idea why this does not work yet
then(applyForTaskUseCase).should()

View File

@@ -10,9 +10,11 @@ import org.springframework.boot.test.autoconfigure.data.mongo.AutoConfigureDataM
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;
import java.util.UUID;
import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureDataMongo
@Import({RosterPersistenceAdapter.class, RosterMapper.class})
public class RosterPersistenceAdapterTest {
@@ -26,7 +28,7 @@ public class RosterPersistenceAdapterTest {
@Test
void addsNewRosterItem(){
String taskId = "TEST-ID";
String taskId = UUID.randomUUID().toString();
String executorType = "TEST-TYPE";
String executorURI = "TEST-URI";
@@ -35,6 +37,8 @@ public class RosterPersistenceAdapterTest {
executorType,
new ExecutorURI(executorURI)
);
adapterUnderTest.addRosterItem(testRosterItem);
MongoRosterDocument retrievedDoc = rosterRepository.findByTaskId(taskId);
@@ -48,7 +52,7 @@ public class RosterPersistenceAdapterTest {
@Test
void retrievesRosterItem(){
String taskId = "TEST-ID";
String taskId = UUID.randomUUID().toString();
String executorType = "TEST-TYPE";
String executorURI = "TEST-URI";
@@ -59,6 +63,6 @@ public class RosterPersistenceAdapterTest {
assertThat(retrievedRosterItem.getTaskID()).isEqualTo(taskId);
assertThat(retrievedRosterItem.getTaskType()).isEqualTo(executorType);
assertThat(retrievedRosterItem.getExecutorURI()).isEqualTo(executorURI);
assertThat(retrievedRosterItem.getExecutorURI().getValue().toString()).isEqualTo(executorURI);
}
}

View File

@@ -1,2 +1,2 @@
spring.data.mongodb.uri=mongodb://127.0.0.1:27017
spring.data.mongodb.database=tapas-tasks
spring.data.mongodb.database=tapas-roster