package net.petrikainulainen.spring.testmvc;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.springframework.http.MediaType;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/**
* @author Petri Kainulainen
*/
public class IntegrationTestUtil {
public static final MediaType APPLICATION_JSON_UTF8 = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));
public static final String CORRECT_PASSWORD = "password";
public static final String CORRECT_USERNAME = "user";
public static final String INCORRECT_PASSWORD = "password1";
public static final String INCORRECT_USERNAME = "user1";
public static final String REQUEST_PARAMETER_PASSWORD = "password";
public static final String REQUEST_PARAMETER_USERNAME = "username";
public static byte[] convertObjectToJsonBytes(Object object) throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
return mapper.writeValueAsBytes(object);
}
}