FormulaTest.java :  » ERP-CRM-Financial » OpenXava-3.0 » org » openxava » test » tests » Java Open Source

Java Open Source » ERP CRM Financial » OpenXava 3.0 
OpenXava 3.0 » org » openxava » test » tests » FormulaTest.java
package org.openxava.test.tests;

import org.openxava.tests.*;



/**
 * @author Javier Paniza
 */

public class FormulaTest extends ModuleTestBase {
  
  public FormulaTest(String testName) {
    super(testName, "Formula");    
  }
  
  public void testDependentReferencesAsDescriptionsListWithHiddenKeyInCollection_aggregateCanHasReferenceToModelOfContainerType() throws Exception {    
    execute("CRUD.new");    
    execute("Collection.new", "viewObject=xava_view_section0_ingredients");
    assertExists("ingredients.anotherFormula.oid"); // Reference to a model of 'Formula' type, the same of the container
    
    String [][] ingredients = {
      { "", "" },
      { "03C5C64CC0A80116000000009590B64C", "AZUCAR" },
      { "03C59CF0C0A8011600000000618CC74B", "CAFE" },
      { "03C6E1ADC0A8011600000000498BC537", "CAFE CON LECHE" },
      { "03C6B61AC0A8011600000000AB4E7ACB", "LECHE" }, 
      { "03C6C61DC0A801160000000076765581", "LECHE CONDENSADA"} 
    };
    
    String [][] empty = {
      { "", "" }
    };
    
    String [][] cafeConLeche = {
        { "", "" },
        { "03C5C64CC0A80116000000009590B64C", "AZUCAR" },
        { "03C59CF0C0A8011600000000618CC74B", "CAFE" },    
        { "03C6B61AC0A8011600000000AB4E7ACB", "LECHE" },              
    };
    
    assertValidValues("ingredients.ingredient.oid", ingredients);
    assertValidValues("ingredients.accentuate.oid", empty);
    
    setValue("ingredients.ingredient.oid", "03C6E1ADC0A8011600000000498BC537");
    assertValidValues("ingredients.ingredient.oid", ingredients);
    assertValidValues("ingredients.accentuate.oid", cafeConLeche);
  }
  
  public void testHtmlTextStereotype() throws Exception {    
    execute("Mode.detailAndFirst");
    assertValue("name", "HTML TEST");
    execute("Sections.change", "activeSection=1");    
    assertTrue("Expected HTML token not found", getHtml().indexOf("Y largo</strong>,<span style=\"background-color: rgb(153, 204, 0);\"> verde </span>") >= 0);
  }
    
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.