All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.modelmapper.projection.example1.ProjectionExample1 Maven / Gradle / Ivy

package org.modelmapper.projection.example1;

import static org.testng.Assert.assertEquals;

import org.modelmapper.ModelMapper;

public class ProjectionExample1 {
  public static void main(String... args) {
    OrderInfo orderInfo = new OrderInfo();
    orderInfo.setCustomerName("Joe Smith");
    orderInfo.setStreetAddress("1234 Main Street");

    ModelMapper modelMapper = new ModelMapper();
    Order order = modelMapper.map(orderInfo, Order.class);

    assertEquals(order.getCustomer().getName(), orderInfo.getCustomerName());
    assertEquals(order.getAddress().getStreet(), orderInfo.getStreetAddress());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy