Search in sources :

Example 1 with CreateStudyTypeDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.dictionary.CreateStudyTypeDTO in project ArachneCentralAPI by OHDSI.

the class StudyTypeControllerTests method testCreateStudyType.

@Test
@DatabaseSetup("/data/study/type/empty-study-type.xml")
@ExpectedDatabase(value = "/data/study/type/added-study-type.xml", assertionMode = NON_STRICT)
public void testCreateStudyType() throws Exception {
    CreateStudyTypeDTO dto = new CreateStudyTypeDTO();
    dto.setName(NAME);
    MvcResult mvcResult = mvc.perform(post("/api/v1/admin/study-types").contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(dto))).andExpect(jsonPath("$.result.id").isNotEmpty()).andExpect(OK_STATUS).andReturn();
    JSONAssert.assertEquals(STUDY_TYPE_JSON_OBJECT, getResultJSONObject(mvcResult), false);
}
Also used : MvcResult(org.springframework.test.web.servlet.MvcResult) CreateStudyTypeDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.CreateStudyTypeDTO) ExpectedDatabase(com.github.springtestdbunit.annotation.ExpectedDatabase) Test(org.junit.Test) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup)

Aggregations

DatabaseSetup (com.github.springtestdbunit.annotation.DatabaseSetup)1 ExpectedDatabase (com.github.springtestdbunit.annotation.ExpectedDatabase)1 CreateStudyTypeDTO (com.odysseusinc.arachne.portal.api.v1.dto.dictionary.CreateStudyTypeDTO)1 Test (org.junit.Test)1 MvcResult (org.springframework.test.web.servlet.MvcResult)1