Examples of TestAction


Examples of org.strecks.injection.handler.impl.TestAction

  @Test
  public void testInjectionSetter()
  {
    InjectionSetter setter = new InjectionSetter(TestAction.class, "setIntegerInput", "integerInput", Integer.class);
    TestAction action = new TestAction();
    setter.setInput(action, new Integer(1));

    assert action.getIntegerInput().equals(1);
  }
View Full Code Here

Examples of org.strecks.injection.handler.impl.TestAction

  }

  @Test
  public void testPrimitives()
  {
    TestAction action = new TestAction();

    InjectionSetter setter = new InjectionSetter(TestAction.class, "setByteInput", "byteInput", Byte.TYPE);
    setter.setInput(action, null);
    assert action.getByteInput() == 0;

    setter.setInput(action, Byte.valueOf((byte) 1));
    assert action.getByteInput() == 1;

    setter = new InjectionSetter(TestAction.class, "setBooleanInput", "booleanInput", Boolean.TYPE);
    setter.setInput(action, null);
    assert action.isBooleanInput() == false;

    setter.setInput(action, Boolean.TRUE);
    assert action.isBooleanInput() == true;

    setter = new InjectionSetter(TestAction.class, "setShortInput", "shortInput", Short.TYPE);
    setter.setInput(action, null);
    assert action.getShortInput() == 0;

    setter.setInput(action, (short) 2);
    assert action.getShortInput() == 2;

    setter = new InjectionSetter(TestAction.class, "setIntInput", "intInput", Integer.TYPE);
    setter.setInput(action, null);
    assert action.getIntInput() == 0;

    setter.setInput(action, 3);
    assert action.getIntInput() == 3;

    setter = new InjectionSetter(TestAction.class, "setPrimitiveLongInput", "primitiveLongInput", Long.TYPE);
    setter.setInput(action, null);
    assert action.getPrimitiveLongInput() == 0;

    setter.setInput(action, 4L);
    assert action.getPrimitiveLongInput() == 4;

    setter = new InjectionSetter(TestAction.class, "setFloatInput", "floatInput", Float.TYPE);
    setter.setInput(action, null);
    assert action.getFloatInput() == 0;

    setter.setInput(action, 5.0F);
    assert action.getFloatInput() == 5.0F;

    setter = new InjectionSetter(TestAction.class, "setDoubleInput", "doubleInput", Double.TYPE);
    setter.setInput(action, null);
    assert action.getDoubleInput() == 0;

    setter.setInput(action, 6.2);
    assert action.getDoubleInput() == 6.2;
  }
View Full Code Here

Examples of org.strecks.injection.handler.impl.TestAction

  private TestAction action;

  @BeforeMethod
  public void setUp()
  {
    action = new TestAction();
  }
View Full Code Here

Examples of org.strecks.injection.handler.impl.TestAction

  @Test
  public void testInvalidType1() throws Exception
  {
    try
    {
      TestAction action = new TestAction();
      Method setterMethod = getSetter(action, "setIntegerInput", Integer.class);
      PropertyValueSetter.setPropertyValue(action, setterMethod, Integer.class,
          "should be an int but is a String");
    }
    catch (ApplicationRuntimeException e)
View Full Code Here

Examples of org.strecks.injection.handler.impl.TestAction

  @Test
  public void testInvalidType2()
  {
    try
    {
      TestAction action = new TestAction();
      PropertyValueSetter.setPropertyValue(action, "integerInput", Integer.class,
          "should be an int but is a String");
    }
    catch (ApplicationRuntimeException e)
    {
View Full Code Here

Examples of org.strecks.injection.handler.impl.TestAction

  }

  @Test
  public void testPropertyValueSetter1() throws Exception
  {
    TestAction action = new TestAction();
    Method setterMethod = getSetter(action, "setIntegerInput", Integer.class);
    PropertyValueSetter.setPropertyValue(action, setterMethod, Integer.class, new Integer(1));
    assert action.getIntegerInput().equals(1);
  }
View Full Code Here

Examples of org.strecks.injection.handler.impl.TestAction

  }

  @Test
  public void testPropertyValueSetter2() throws Exception
  {
    TestAction action = new TestAction();
    Method setterMethod = getSetter(action, "setIntegerInput", Integer.class);
    PropertyDescriptor descriptor = BeanUtils.findPropertyForMethod(setterMethod);

    PropertyValueSetter.setPropertyValue(action, descriptor, new Integer(1));
    assert action.getIntegerInput().equals(1);
  }
View Full Code Here

Examples of org.strecks.injection.handler.impl.TestAction

  }

  @Test
  public void testPropertyValueSetter3() throws Exception
  {
    TestAction action = new TestAction();
    PropertyValueSetter.setPropertyValue(action, "integerInput", Integer.class, new Integer(1));
    assert action.getIntegerInput().equals(1);
  }
View Full Code Here

Examples of org.strecks.injection.handler.impl.TestAction

  }

  @Test
  public void testPrimitives2() throws NoSuchMethodException
  {
    TestAction action = new TestAction();

    PropertyValueSetter.setPropertyValue(action, "byteInput", Byte.TYPE, null);
    assert action.getByteInput() == 0;

    PropertyValueSetter.setPropertyValue(action, "byteInput", Byte.TYPE, (byte) 1);
    assert action.getByteInput() == 1;

    PropertyValueSetter.setPropertyValue(action, "booleanInput", Boolean.TYPE, null);
    assert action.isBooleanInput() == false;

    PropertyValueSetter.setPropertyValue(action, "booleanInput", Boolean.TYPE, true);
    assert action.isBooleanInput() == true;

    PropertyValueSetter.setPropertyValue(action, "shortInput", Short.TYPE, null);
    assert action.getShortInput() == 0;

    PropertyValueSetter.setPropertyValue(action, "shortInput", Short.TYPE, (short) 2);
    assert action.getShortInput() == 2;

    PropertyValueSetter.setPropertyValue(action, "intInput", Integer.TYPE, null);
    assert action.getIntInput() == 0;

    PropertyValueSetter.setPropertyValue(action, "intInput", Integer.TYPE, (int) 3);
    assert action.getIntInput() == 3;

    PropertyValueSetter.setPropertyValue(action, "primitiveLongInput", Long.TYPE, null);
    assert action.getPrimitiveLongInput() == 0;

    PropertyValueSetter.setPropertyValue(action, "primitiveLongInput", Long.TYPE, 4L);
    assert action.getPrimitiveLongInput() == 4;

    PropertyValueSetter.setPropertyValue(action, "floatInput", Float.TYPE, null);
    assert action.getFloatInput() == 0;

    PropertyValueSetter.setPropertyValue(action, "floatInput", Float.TYPE, 5.0F);
    assert action.getFloatInput() == 5.0F;

    PropertyValueSetter.setPropertyValue(action, "doubleInput", Double.TYPE, null);
    assert action.getDoubleInput() == 0;

    PropertyValueSetter.setPropertyValue(action, "doubleInput", Double.TYPE, 6.2);
    assert action.getDoubleInput() == 6.2;
  }
View Full Code Here

Examples of org.strecks.injection.handler.impl.TestAction

  @Test
  public void testInputReader()
  {
    InjectionAnnotationReader c = new InjectionAnnotationReader();
    TestAction action = new TestAction();
    c.readAnnotations(action.getClass());
    Map<String, InjectionWrapper> inputs = c.getInjectionMap();

    Assert.assertEquals(inputs.size(), 10);

    InjectionWrapper wrapper = inputs.get("integerInput");
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.