1 package org.imageconverter.controller.imagetype;
2
3 import org.imageconverter.controller.ImageTypeRestController;
4 import org.springframework.test.web.servlet.MockMvc;
5
6 import com.fasterxml.jackson.core.JsonProcessingException;
7 import com.fasterxml.jackson.databind.ObjectMapper;
8
9
10
11
12
13
14 class ImageTypeRestControllerUnHappyPathBaseTest {
15
16
17
18
19
20
21
22
23 protected final ObjectMapper mapper;
24
25 protected final MockMvc mvc;
26
27 ImageTypeRestControllerUnHappyPathBaseTest(final ObjectMapper mapper, final MockMvc mvc) {
28 super();
29 this.mapper = mapper;
30 this.mvc = mvc;
31 }
32
33 String asJsonString(final Object object) {
34
35 try {
36 return mapper.writeValueAsString(object);
37 } catch (final JsonProcessingException e) {
38 throw new IllegalStateException(e);
39 }
40 }
41 }