View Javadoc

1   /*
2    * $Id: TestDependentObject.java 7976 2007-08-21 14:26:13Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.tck.testmodels.mule;
12  
13  import org.mule.config.PropertyFactory;
14  import org.mule.tck.testmodels.fruit.Orange;
15  
16  import java.util.Map;
17  
18  /**
19   * <code>TestDependentObject</code> is used as a mock dependency for an object
20   * 
21   * @author <a href="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
22   * @version $Revision: 7976 $
23   */
24  public class TestDependentObject implements PropertyFactory
25  {
26      public Object create(Map properties) throws Exception
27      {
28          // make sure that both test properties are set here
29          if (properties.get("test1") == null || properties.get("test2") == null)
30          {
31              throw new Exception("Both properties should be set before the factory method is called");
32          }
33          return new Orange();
34      }
35  }