Skip to content
Snippets Groups Projects
Commit 1893a2e4 authored by Viceníková Jitka's avatar Viceníková Jitka
Browse files

fix: tests for car service & visualization it

parent 9698680d
No related branches found
No related tags found
4 merge requests!54Merge develop into main,!48Scenario,!46Visualization pdf,!44Security
Pipeline #
......@@ -113,7 +113,7 @@ public class CarService extends DomainService<Car> {
try {
sendPostRequest(savedCar);
} catch (RestClientException | IllegalArgumentException e) {
} catch (Exception e) {
log.debug(String.format("The visualization module is not reachable on the URL: %s, exception %s", VISUALIZATION_MODULE_URL + VISUALIZATION_MODULE_URI, e));
}
......
package cz.muni.pa165.rest;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import cz.muni.pa165.generated.model.CarDto;
......@@ -14,6 +13,8 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import java.util.Map;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
......@@ -36,7 +37,7 @@ class VisualizationIT {
log.info("testGenerateCarPdf() running");
var carDto = new CarDto().id(1L);
var requestBody = mapper.writeValueAsString(carDto);
var requestBody = mapper.writeValueAsString(Map.of("car", carDto));
String response = mockMvc.perform(
post("/visualization")
......@@ -50,6 +51,4 @@ class VisualizationIT {
Assertions.assertNotNull(response);
Assertions.assertEquals("application/pdf", response);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment