Package net.firstpartners.sample.multiple

Source Code of net.firstpartners.sample.multiple.MultipleRulesExampleTest

package net.firstpartners.sample.multiple;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import java.io.IOException;

import net.firstpartners.sample.multiple.CustomerOrder;
import net.firstpartners.sample.multiple.MultipleRulesExample;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.drools.compiler.DroolsParserException;
import org.junit.Test;


/**
* Turns the Multiple Rules Example into a JunitTest
* @author paul
*
*/
public class MultipleRulesExampleTest {

  private static Log log = LogFactory.getLog(MultipleRulesExampleTest.class);

  @Test
  public final void testRunMultipleRulesExample() throws DroolsParserException, IOException, ClassNotFoundException {

    //Run the Rules Example, almost as if from the command line
    MultipleRulesExample thisSample = new MultipleRulesExample();
    CustomerOrder co =thisSample.runMultipleRulesExample();


    //Check the final co object to ensure that the rules have run as we expected
    assertNotNull(co);
    assertEquals(co.getInitialBalance(),2000);
    assertEquals(co.getCurrentBalance(),0);

    assertNotNull(co.getShipments());
    assertEquals(co.getShipments().size(),10);


  }

}
TOP

Related Classes of net.firstpartners.sample.multiple.MultipleRulesExampleTest

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.