Search in sources :

Example 1 with StudyProgrammeCategory

use of fi.otavanopisto.pyramus.rest.model.StudyProgrammeCategory in project muikku by otavanopisto.

the class PyramusMocks method mockStudyProgrammes.

private static void mockStudyProgrammes() throws JsonProcessingException {
    ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
    StudyProgrammeCategory spc = new StudyProgrammeCategory(1l, "All Study Programmes", 1l, false);
    StudyProgramme sp = new StudyProgramme(1l, "test", "Test Study Programme", 1l, false);
    StudyProgramme[] sps = { sp };
    StudyProgrammeCategory[] spcs = { spc };
    stubFor(get(urlEqualTo("/1/students/studyProgrammes")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(objectMapper.writeValueAsString(sps)).withStatus(200)));
    stubFor(get(urlEqualTo("/1/students/studyProgrammes/1")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(objectMapper.writeValueAsString(sp)).withStatus(200)));
    stubFor(get(urlEqualTo("/1/students/studyProgrammeCategories")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(objectMapper.writeValueAsString(spcs)).withStatus(200)));
    stubFor(get(urlEqualTo("/1/students/studyProgrammeCategories/1")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(objectMapper.writeValueAsString(spc)).withStatus(200)));
}
Also used : StudyProgramme(fi.otavanopisto.pyramus.rest.model.StudyProgramme) StudyProgrammeCategory(fi.otavanopisto.pyramus.rest.model.StudyProgrammeCategory) JSR310Module(com.fasterxml.jackson.datatype.jsr310.JSR310Module) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 2 with StudyProgrammeCategory

use of fi.otavanopisto.pyramus.rest.model.StudyProgrammeCategory in project muikku by otavanopisto.

the class PyramusMocksRest method mockStudyProgrammes.

private static void mockStudyProgrammes(List<String> payloads) throws JsonProcessingException {
    ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
    StudyProgrammeCategory spc = new StudyProgrammeCategory(1l, "All Study Programmes", 1l, false);
    StudyProgramme sp = new StudyProgramme(1l, "test", "Test Study Programme", 1l, false);
    StudyProgramme[] sps = { sp };
    StudyProgrammeCategory[] spcs = { spc };
    stubFor(get(urlEqualTo("/1/students/studyProgrammes")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(objectMapper.writeValueAsString(sps)).withStatus(200)));
    stubFor(get(urlEqualTo("/1/students/studyProgrammes/1")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(objectMapper.writeValueAsString(sp)).withStatus(200)));
    stubFor(get(urlEqualTo("/1/students/studyProgrammeCategories")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(objectMapper.writeValueAsString(spcs)).withStatus(200)));
    stubFor(get(urlEqualTo("/1/students/studyProgrammeCategories/1")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(objectMapper.writeValueAsString(spc)).withStatus(200)));
}
Also used : StudyProgramme(fi.otavanopisto.pyramus.rest.model.StudyProgramme) StudyProgrammeCategory(fi.otavanopisto.pyramus.rest.model.StudyProgrammeCategory) JSR310Module(com.fasterxml.jackson.datatype.jsr310.JSR310Module) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 JSR310Module (com.fasterxml.jackson.datatype.jsr310.JSR310Module)2 StudyProgramme (fi.otavanopisto.pyramus.rest.model.StudyProgramme)2 StudyProgrammeCategory (fi.otavanopisto.pyramus.rest.model.StudyProgrammeCategory)2