Search in sources :

Example 1 with CourseType

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

the class PyramusMocksRest method mockCommons.

public static void mockCommons() throws JsonProcessingException {
    ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
    EducationType educationType = new EducationType((long) 1, "testEduType", "ET", false);
    String educationTypeJson = objectMapper.writeValueAsString(educationType);
    stubFor(get(urlEqualTo("/1/common/educationTypes/1")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(educationTypeJson).withStatus(200)));
    EducationType[] educationTypeArray = { educationType };
    String educationTypeArrayJson = objectMapper.writeValueAsString(educationTypeArray);
    stubFor(get(urlEqualTo("/1/common/educationTypes")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(educationTypeArrayJson).withStatus(200)));
    EducationalTimeUnit educationalTimeUnit = new EducationalTimeUnit((long) 1, "test time unit", "h", (double) 1, false);
    String eduTimeUnitJson = objectMapper.writeValueAsString(educationalTimeUnit);
    stubFor(get(urlEqualTo("/1/common/educationalTimeUnits/1")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(eduTimeUnitJson).withStatus(200)));
    EducationalTimeUnit[] eduTimeUnitArray = { educationalTimeUnit };
    String eduTimeUnitArrayJson = objectMapper.writeValueAsString(eduTimeUnitArray);
    stubFor(get(urlEqualTo("/1/common/educationalTimeUnits")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(eduTimeUnitArrayJson).withStatus(200)));
    fi.otavanopisto.pyramus.rest.model.CourseType courseType = new fi.otavanopisto.pyramus.rest.model.CourseType((long) 1, "Nonstop", false);
    CourseType[] courseTypeArray = { courseType };
    String courseTypeJson = objectMapper.writeValueAsString(courseTypeArray);
    stubFor(get(urlEqualTo("/1/courses/courseTypes")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(courseTypeJson).withStatus(200)));
    String courseTypeSingleJson = objectMapper.writeValueAsString(courseType);
    stubFor(get(urlEqualTo("/1/courses/courseTypes/1")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(courseTypeSingleJson).withStatus(200)));
}
Also used : CourseType(fi.otavanopisto.pyramus.rest.model.CourseType) EducationType(fi.otavanopisto.pyramus.rest.model.EducationType) JSR310Module(com.fasterxml.jackson.datatype.jsr310.JSR310Module) CourseType(fi.otavanopisto.pyramus.rest.model.CourseType) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) EducationalTimeUnit(fi.otavanopisto.pyramus.rest.model.EducationalTimeUnit)

Example 2 with CourseType

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

the class PyramusMocks method mockCourseTypes.

public static void mockCourseTypes() throws JsonProcessingException {
    ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
    fi.otavanopisto.pyramus.rest.model.CourseType courseType = new fi.otavanopisto.pyramus.rest.model.CourseType((long) 1, "Nonstop", false);
    CourseType[] courseTypeArray = { courseType };
    String courseTypeJson = objectMapper.writeValueAsString(courseTypeArray);
    stubFor(get(urlEqualTo("/1/courses/courseTypes")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(courseTypeJson).withStatus(200)));
    String courseTypeSingleJson = objectMapper.writeValueAsString(courseType);
    stubFor(get(urlEqualTo("/1/courses/courseTypes/1")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(courseTypeSingleJson).withStatus(200)));
}
Also used : CourseType(fi.otavanopisto.pyramus.rest.model.CourseType) JSR310Module(com.fasterxml.jackson.datatype.jsr310.JSR310Module) CourseType(fi.otavanopisto.pyramus.rest.model.CourseType) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 JSR310Module (com.fasterxml.jackson.datatype.jsr310.JSR310Module)2 CourseType (fi.otavanopisto.pyramus.rest.model.CourseType)2 EducationType (fi.otavanopisto.pyramus.rest.model.EducationType)1 EducationalTimeUnit (fi.otavanopisto.pyramus.rest.model.EducationalTimeUnit)1