View Javadoc
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   * Test the {@link ImageTypeRestController} controller on unhappy path, only base feature.
11   * 
12   * @author Fernando Romulo da Silva
13   */
14  class ImageTypeRestControllerUnHappyPathBaseTest {
15  
16      // JSqlParser
17      // @Value("classpath:db/db-data-test.sql")
18      // private Resource dbDataTest;
19  
20      // @Value("classpath:image.png")
21      // private Resource imageFile;
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  }