diff --git a/application/module-certificate/src/test/java/org/fuseri/modulecertificate/ModuleCertificateCertificateControllerTests.java b/application/module-certificate/src/test/java/org/fuseri/modulecertificate/ModuleCertificateCertificateControllerTests.java deleted file mode 100644 index 16a08fc331b1dfd918e15997187de6bebd972277..0000000000000000000000000000000000000000 --- a/application/module-certificate/src/test/java/org/fuseri/modulecertificate/ModuleCertificateCertificateControllerTests.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.fuseri.modulecertificate; - -import com.fasterxml.jackson.databind.ObjectMapper; -import org.fuseri.model.dto.certificate.CertificateCreateDto; -import org.fuseri.model.dto.certificate.CertificateDto; -import org.fuseri.model.dto.course.CourseDto; -import org.fuseri.model.dto.course.LanguageTypeDto; -import org.fuseri.model.dto.course.ProficiencyLevelDto; -import org.fuseri.model.dto.user.AddressDto; -import org.fuseri.model.dto.user.UserDto; -import org.fuseri.modulecertificate.service.CertificateController; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.http.MediaType; -import org.springframework.test.web.servlet.MockMvc; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - - -@SpringBootTest -@AutoConfigureMockMvc -class ModuleCertificateCertificateControllerTests { - - @Autowired - private MockMvc mockMvc; - - @Autowired - ObjectMapper objectMapper; - - @Test - void generateCertificate() throws Exception { - CertificateDto expectedResponse = new CertificateDto(); - String response = mockMvc.perform(post("/certificates/generate") - .content(asJsonString(new CertificateCreateDto( - new UserDto("novakovat","novakova@gamil.com", "Tereza", - "Nováková", new AddressDto()), - new CourseDto("AJ1", 10, LanguageTypeDto.ENGLISH, ProficiencyLevelDto.A1)))) - .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andReturn().getResponse().getContentAsString(); - CertificateController certificateController = objectMapper.readValue(response, CertificateController.class); - assertThat("response", certificateController.find(0L), is(instanceOf(expectedResponse.getClass()))); - } - - - @Test - void deleteCertificate() throws Exception { - String response = mockMvc.perform(delete("/certificates/delete") - .param("id", "1")) - .andExpect(status().isOk()) - .andReturn().getResponse().getContentAsString(); - } - - public static String asJsonString(final Object obj) { - try { - return new ObjectMapper().writeValueAsString(obj); - } catch (Exception e) { - throw new RuntimeException(e); - } - } -}