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