1   /*
2    * $Id: TestDependentObject.java 10787 2008-02-12 18:51:50Z dfeist $
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.api.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  public class TestDependentObject implements PropertyFactory
22  {
23      public Object create(Map properties) throws Exception
24      {
25          // make sure that both test properties are set here
26          if (properties.get("test1") == null || properties.get("test2") == null)
27          {
28              throw new Exception("Both properties should be set before the factory method is called");
29          }
30          return new Orange();
31      }
32  }