// Path: examples/microservice/dao-api/src/main/java/org/osgi/enroute/examples/microservice/dao/dto/AddressDTO.java
// public class AddressDTO {
// 
// 	public long personId;
// 	public String emailAddress;
// 	public String city;
// 	public String country;
// }
// 
// Path: examples/microservice/dao-api/src/main/java/org/osgi/enroute/examples/microservice/dao/dto/PersonDTO.java
// public class PersonDTO {
// 
// 	public long personId;
// 	public String firstName;
// 	public String lastName;
// 
// 	public List<AddressDTO> addresses = new ArrayList<>();
// }


import static org.junit.Assert.assertEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import org.junit.Test;
import org.osgi.enroute.examples.microservice.dao.dto.AddressDTO;
import org.osgi.enroute.examples.microservice.dao.dto.PersonDTO;
package org.osgi.enroute.examples.microservice.rest;





public class JsonConverterTest {
    
    @Test
    public void testJSONSerialization() throws WebApplicationException, IOException {
        
        JsonpConvertingPlugin<PersonDTO> plugin = new JsonpConvertingPlugin<>();
        
        
        PersonDTO dto = new PersonDTO();
        dto.firstName = "Tim";
        dto.lastName = "Ward";
        dto.personId = 1234;
        
        AddressDTO dto2 = new AddressDTO();
        dto2.city = "London";
        dto2.country = "UK";
        dto2.personId = dto.personId;
        dto2.emailAddress = "tim.ward@paremus.com";
        
        dto.addresses.add(dto2);
        
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        
        plugin.writeTo(dto, PersonDTO.class, PersonDTO.class, null, MediaType.APPLICATION_JSON_TYPE, null, baos);
        
// Path: examples/microservice/dao-api/src/main/java/org/osgi/enroute/examples/microservice/dao/dto/AddressDTO.java
// public class AddressDTO {
// 
// 	public long personId;
// 	public String emailAddress;
// 	public String city;
// 	public String country;
// }
// 
// Path: examples/microservice/dao-api/src/main/java/org/osgi/enroute/examples/microservice/dao/dto/PersonDTO.java
// public class PersonDTO {
// 
// 	public long personId;
// 	public String firstName;
// 	public String lastName;
// 
// 	public List<AddressDTO> addresses = new ArrayList<>();
// }


// Path: examples/microservice/rest-service/src/test/java/org/osgi/enroute/examples/microservice/rest/JsonConverterTest.java
import static org.junit.Assert.assertEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import org.junit.Test;
import org.osgi.enroute.examples.microservice.dao.dto.AddressDTO;
import org.osgi.enroute.examples.microservice.dao.dto.PersonDTO;

package org.osgi.enroute.examples.microservice.rest;





public class JsonConverterTest {
    
    @Test
    public void testJSONSerialization() throws WebApplicationException, IOException {
        
        JsonpConvertingPlugin<PersonDTO> plugin = new JsonpConvertingPlugin<>();
        
        
        PersonDTO dto = new PersonDTO();
        dto.firstName = "Tim";
        dto.lastName = "Ward";
        dto.personId = 1234;
        
        AddressDTO dto2 = new AddressDTO();
        dto2.city = "London";
        dto2.country = "UK";
        dto2.personId = dto.personId;
        dto2.emailAddress = "tim.ward@paremus.com";
        
        dto.addresses.add(dto2);
        
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        
        plugin.writeTo(dto, PersonDTO.class, PersonDTO.class, null, MediaType.APPLICATION_JSON_TYPE, null, baos);
        
        PersonDTO roundTrip = plugin.readFrom(PersonDTO.class, PersonDTO.class,null, MediaType.APPLICATION_JSON_TYPE, 