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)));
}
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)));
}
Aggregations