Examples of TargetBean


Examples of org.strecks.bind.handler.impl.TargetBean

    ConversionHandler conversionHandler = createStrictMock(ConversionHandler.class);

    IntToIntConverter converter = new IntToIntConverter();
    BindSimpleHandler handler = new BindSimpleHandler();
    TargetBean bean = new TargetBean();
    bean.setStringProperty("2");
    ApplicationRuntimeException exception = new ApplicationRuntimeException();

    handler.setConversionHandler(conversionHandler);

    expect(handler.getAndConvertOutwards(bean, "stringProperty", converter)).andThrow(exception);
View Full Code Here

Examples of org.strecks.bind.handler.impl.TargetBean

    converter.setTargetClass(Integer.class);
    replay(converter);

    BindableBean form = new BindableBean();

    TargetBean targetBean = new TargetBean();
    form.setTargetBean(targetBean);

    handler.bindInwards(form, form, 4);
    Assert.assertEquals(targetBean.getIntegerProperty().intValue(), 4);

    verify(converter);
    reset(converter);

    converter.setTargetClass(Integer.class);
    replay(converter);
    handler.bindInwards(form, form, ConversionState.NULL);
    Assert.assertEquals(targetBean.getIntegerProperty(), null);
    verify(converter);
    reset(converter);

    converter.setTargetClass(Integer.class);
    expect(converter.toTargetType(null)).andReturn(null);
    replay(converter);
    handler.bindInwards(form, form, ConversionState.FAILURE);
    Assert.assertEquals(targetBean.getIntegerProperty(), null);
    verify(converter);
  }
View Full Code Here

Examples of org.strecks.bind.handler.impl.TargetBean

  public void testTargetBindOutwards()
  {

    BindableBean form = new BindableBean();

    TargetBean targetBean = new TargetBean();
    form.setTargetBean(targetBean);

    targetBean.setIntegerProperty(4);
    handler.bindOutwards(form, form);
    Assert.assertEquals(form.getIntProperty(), "4");

  }
View Full Code Here

Examples of org.strecks.bind.handler.impl.TargetBean

  public void testTargetBindInwards()
  {

    BindableBean form = new BindableBean();

    TargetBean targetBean = new TargetBean();
    form.setTargetBean(targetBean);

    form.setIntProperty("4");
    handler.bindInwards(form, form, null);
    Assert.assertEquals(targetBean.getIntegerProperty().intValue(), 4);

  }
View Full Code Here

Examples of org.strecks.bind.handler.impl.TargetBean

  {
    handler.setBeanPropertyName("duffProperty");

    BindableBean form = new BindableBean();

    TargetBean targetBean = new TargetBean();
    form.setTargetBean(targetBean);

    form.setIntProperty("4");
    handler.bindInwards(form, form, null);
  }
View Full Code Here

Examples of org.strecks.bind.handler.impl.TargetBean

  {
    handler.setBeanPropertyName("duffProperty");

    BindableBean form = new BindableBean();

    TargetBean targetBean = new TargetBean();
    form.setTargetBean(targetBean);

    targetBean.setIntegerProperty(4);
    handler.bindOutwards(form, form);
  }
View Full Code Here

Examples of org.strecks.bind.handler.impl.TargetBean

  @Test
  public void testOutwardConversion()
  {
    DefaultConversionHandler handler = new DefaultConversionHandler();
    TargetBean bean = new TargetBean();
    bean.setStringProperty("2");
    Assert.assertEquals(handler.getAndConvertOutwards(bean, "stringProperty", new StringToStringConverter()), "2");
  }
View Full Code Here

Examples of org.strecks.bind.handler.impl.TargetBean

 
  @Test
  public void testInwardConversion()
  {
    DefaultConversionHandler handler = new DefaultConversionHandler();
    TargetBean bean = new TargetBean();
    bean.setStringProperty("2");
    Assert.assertEquals(handler.getAndConvertInwards(bean, "stringProperty", new StringToStringConverter()), "2");
  }
View Full Code Here

Examples of org.strecks.bind.handler.impl.TargetBean

  public void testInvalidOutwardConversion()
  {
    try
    {
      DefaultConversionHandler handler = new DefaultConversionHandler();
      TargetBean bean = new TargetBean();
      bean.setStringProperty("2");
      handler.getAndConvertOutwards(bean, "stringProperty", new IntToIntConverter());
      Assert.fail();
    }
    catch (ApplicationRuntimeException e)
    {
View Full Code Here

Examples of org.strecks.bind.handler.impl.TargetBean

  public void testInvalidInwardConversion()
  {
    try
    {
      DefaultConversionHandler handler = new DefaultConversionHandler();
      TargetBean bean = new TargetBean();
      bean.setStringProperty("2");
      handler.getAndConvertInwards(bean, "stringProperty", new IntToIntConverter());
      Assert.fail();
    }
    catch (ApplicationRuntimeException e)
    {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.