Package org.springframework.batch.sample.domain.order

Examples of org.springframework.batch.sample.domain.order.ShippingInfo


  }

  @Test
  public void testValidShipping() {
    Order order = new Order();
    ShippingInfo info = new ShippingInfo();
    info.setShipperId("INVALID");
    info.setShippingTypeId("INVALID");
    order.setShipping(info);

    Errors errors = new BeanPropertyBindingResult(order, "validOrder");
    orderValidator.validateShipping(info, errors);

    assertEquals(2, errors.getAllErrors().size());
    assertEquals("error.shipping.shipper", errors.getFieldError("shipping.shipperId").getCode());
    assertEquals("error.shipping.type", errors.getFieldError("shipping.shippingTypeId").getCode());

    info = new ShippingInfo();
    info.setShipperId("FEDX");
    info.setShippingTypeId("EXP");
    info.setShippingInfo("12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");
    order.setShipping(info);

    errors = new BeanPropertyBindingResult(order, "validOrder");
    orderValidator.validateShipping(info, errors);

    assertEquals(1, errors.getAllErrors().size());
    assertEquals("error.shipping.shippinginfo.length", errors.getFieldError("shipping.shippingInfo").getCode());

    info = new ShippingInfo();
    info.setShipperId("FEDX");
    info.setShippingTypeId("EXP");
    info.setShippingInfo("Info");
    order.setShipping(info);

    errors = new BeanPropertyBindingResult(order, "validOrder");
    orderValidator.validateShipping(info, errors);
View Full Code Here


  public static final String SHIPPING_TYPE_ID_COLUMN = "SHIPPING_TYPE_ID";
  public static final String SHIPPER_ID_COLUMN = "SHIPPER_ID";

  @Override
  public ShippingInfo mapFieldSet(FieldSet fieldSet) {
    ShippingInfo info = new ShippingInfo();

    info.setShipperId(fieldSet.readString(SHIPPER_ID_COLUMN));
    info.setShippingTypeId(fieldSet.readString(SHIPPING_TYPE_ID_COLUMN));
    info.setShippingInfo(fieldSet.readString(ADDITIONAL_SHIPPING_INFO_COLUMN));

    return info;
  }
View Full Code Here

TOP

Related Classes of org.springframework.batch.sample.domain.order.ShippingInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.