Package org.araneaframework.tests.mock

Examples of org.araneaframework.tests.mock.MockEnviroment


  private FormWidget makeVoForm() throws Exception {

    //Creating form :-)
    FormWidget voForm = new FormWidget();
    voForm._getComponent().init(new MockEnviroment());
   
    //Adding elements to form
    voForm.addElement("booleanValue", "vo checkbox", new CheckboxControl(), new BooleanData(), true);
    voForm.addElement("stringValue", "vo text", new TextControl(), new StringData(), true);
    voForm.addElement("longValue", "vo long", new TextControl(), new LongData(), true);
View Full Code Here


    MockHttpServletRequest emptyRequest = new MockHttpServletRequest();
    emptyRequest.addParameter("myTextBox", "");

    FormElement sfe = new FormElement();
   
    sfe._getComponent().init(new MockEnviroment());
   
    TextControl tb = new TextControl();
    tb.setMandatory(true);
   
    sfe.setControl(tb);
View Full Code Here

   */
  public void testMultiSelectOnEmptyRequest() throws Exception {

    MockHttpServletRequest emptyRequest = new MockHttpServletRequest();
    MultiSelectControl ms = new MultiSelectControl();
    ms._getComponent().init(new MockEnviroment());
    MockUiLibUtil.emulateHandleRequest(ms, "myMultiSelect", emptyRequest);   
    ms.convertAndValidate();

    assertNotNull("MultiSelect must not return null if it's not present in request", ms.getRawValue());
    assertTrue("MultiSelect must return List if it's not present in request", ms.getRawValue() instanceof List);
View Full Code Here

  public void testTextboxOnEmptyRequest() throws Exception {
    MockHttpServletRequest emptyRequest = new MockHttpServletRequest();
    emptyRequest.addParameter("myTextBox", "");

    TextControl tb = new TextControl();  
    tb._getComponent().init(new MockEnviroment());
    MockUiLibUtil.emulateHandleRequest(tb, "myTextBox", emptyRequest);
    tb.convertAndValidate();

    assertNull("TextBox must return null on empty request.", tb.getRawValue());
View Full Code Here

    String DEV_NULL = "/dev/null";
   
    valueRequest.addParameter("myTextBox", DEV_NULL);

    TextControl tb = new TextControl();
    tb._getComponent().init(new MockEnviroment());
    MockUiLibUtil.emulateHandleRequest(tb, "myTextBox", valueRequest);
    StringArrayRequestControl.ViewModel vm = (StringArrayRequestControl.ViewModel) tb._getViewable().getViewModel();
   
    assertEquals("TextBox must contain the value from request!", DEV_NULL, vm.getSimpleValue());
   
View Full Code Here

  public void testNumberControlSimpleValidation() throws Exception {
    MockHttpServletRequest correctValueRequest = new MockHttpServletRequest();
    correctValueRequest.addParameter("myNumberInput", "108");
   
    NumberControl nc = new NumberControl();
    nc._getComponent().init(new MockEnviroment());
    MockUiLibUtil.emulateHandleRequest(nc, "myNumberInput", correctValueRequest);
    nc.convertAndValidate();
   
    assertTrue("Number control must be valid.", nc.isValid());
    assertTrue("Number control value must be a 'BigInteger'.", nc.getRawValue() instanceof BigInteger);
View Full Code Here

  public void testNumberControlMinMaxValidation() throws Exception {
    MockHttpServletRequest correctValueRequest = new MockHttpServletRequest();
    correctValueRequest.addParameter("myNumberInput", "50");
   
    NumberControl nc = new NumberControl();
    nc._getComponent().init(new MockEnviroment());
   
    nc.setMinValue(new BigInteger("25"));
    nc.setMaxValue(new BigInteger("75"));
   
    MockUiLibUtil.emulateHandleRequest(nc, "myNumberInput", correctValueRequest);
View Full Code Here

  public void testFloatControlSimpleValidation() throws Exception {
    MockHttpServletRequest correctValueRequest = new MockHttpServletRequest();
    correctValueRequest.addParameter("myFloatInput", "28.012");
   
    FloatControl nc = new FloatControl();
    nc._getComponent().init(new MockEnviroment());
    MockUiLibUtil.emulateHandleRequest(nc, "myFloatInput", correctValueRequest);
    nc.convertAndValidate();
   
    assertTrue("Float control must be valid.", nc.isValid());
    assertTrue("Float control value must be a 'BigDecimal'.", nc.getRawValue() instanceof BigDecimal);
View Full Code Here

  public void testFloatControlMinMaxValidation() throws Exception {
    MockHttpServletRequest correctValueRequest = new MockHttpServletRequest();
    correctValueRequest.addParameter("myFloatInput", "50.0018");
   
    FloatControl nc = new FloatControl();
    nc._getComponent().init(new MockEnviroment());
   
    nc.setMinValue(new BigDecimal("25.001"));
    nc.setMaxValue(new BigDecimal("75.002"));
   
    MockUiLibUtil.emulateHandleRequest(nc, "myFloatInput", correctValueRequest);
View Full Code Here

  public void testPersonalIdControlSimpleValidation() throws Exception {
    MockHttpServletRequest correctValueRequest = new MockHttpServletRequest();
    correctValueRequest.addParameter("myPersonalIdInput", "38304280235");
   
    TextControl pic = new TextControl(TextType.EST_PERSONAL_ID);
    pic._getComponent().init(new MockEnviroment());
    MockUiLibUtil.emulateHandleRequest(pic, "myPersonalIdInput", correctValueRequest);
    pic.convertAndValidate();
   
    assertTrue("Personal id control must be valid.", pic.isValid());
    assertTrue("Personal id control value must be a 'String'.", pic.getRawValue() instanceof String);
View Full Code Here

TOP

Related Classes of org.araneaframework.tests.mock.MockEnviroment

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.