incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r822565 [2/4] - in /incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries: mocks/ unittest/junit/ unittest/mocks/ unittest/mocks/annotations/
Date Wed, 07 Oct 2009 03:00:44 GMT
Modified: incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/DefaultInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/DefaultInvocationHandler.java?rev=822565&r1=822564&r2=822565&view=diff
==============================================================================
--- incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/DefaultInvocationHandler.java (original)
+++ incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/DefaultInvocationHandler.java Wed Oct  7 03:00:43 2009
@@ -1,111 +1,111 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.aries.unittest.mocks;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-
-/**
- * <p>This invocation handler is used by the Skeleton when nothing else is
- *   matched. If the return type is an interface it creates a dynamic proxy
- *   backed by the associated skeleton for return, if it is a class with a
- *   default constructor that will be returned.
- * </p>
- */
-public class DefaultInvocationHandler implements InvocationHandler
-{
-  /** The skeleton this handler is associated with */
-  private Skeleton _s;
-  
-  /* ------------------------------------------------------------------------ */
-  /* DefaultInvocationHandler constructor                                    
-  /* ------------------------------------------------------------------------ */
-  /**
-   * Creates an instance called by the specified skeleton.
-   *
-   * @param s The caller.
-   */
-  public DefaultInvocationHandler(Skeleton s)
-  {
-    this._s = s;
-  }
-  
-  /* ------------------------------------------------------------------------ */
-  /* invoke method                                    
-  /* ------------------------------------------------------------------------ */
-  /**
-   * Invoked when no ReturnType or MethodCall Handlers are defined.
-   * 
-   * @param target     The target object that was invoked. 
-   * @param method     The method that was invoked.
-   * @param arguments  The arguments that were passed.
-   * @return           A proxy or null.
-   * @throws Throwable
-   */
-  public Object invoke(Object target, Method method, Object[] arguments)
-      throws Throwable
-  {
-    Class<?> returnType = method.getReturnType();
-    Object obj = null;
-    
-    if (returnType.isInterface())
-    {
-      obj = createProxy(new Class[] { returnType });
-    }
-    else 
-    {
-      try
-      {
-        obj = returnType.newInstance();
-      }
-      catch (Exception e)
-      {
-        // if this occurs then assume no default constructor was visible.
-      }
-    }
-    
-    return obj;
-  }
-  
-  /* ------------------------------------------------------------------------ */
-  /* createProxy method                                    
-  /* ------------------------------------------------------------------------ */
-  /**
-   * Creates and returns a proxy backed by the associated skeleton, that 
-   * implements the specified interfaces. Null is returned if the return
-   * type array contains non interfaces.
-   * 
-   * @param returnTypes The classes.
-   * @return            The proxy or null.
-   */
-  public Object createProxy(Class<?> ... returnTypes)
-  {
-    Object result = null;
-    
-    boolean allInterfaces = true;
-    for(int i = 0; (allInterfaces && i<returnTypes.length); i++)
-       allInterfaces = returnTypes[i].isInterface();
-    
-    if (allInterfaces)
-    {
-      result = _s.createMock(returnTypes);
-    }
-    return result;
-  }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.unittest.mocks;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+/**
+ * <p>This invocation handler is used by the Skeleton when nothing else is
+ *   matched. If the return type is an interface it creates a dynamic proxy
+ *   backed by the associated skeleton for return, if it is a class with a
+ *   default constructor that will be returned.
+ * </p>
+ */
+public class DefaultInvocationHandler implements InvocationHandler
+{
+  /** The skeleton this handler is associated with */
+  private Skeleton _s;
+  
+  /* ------------------------------------------------------------------------ */
+  /* DefaultInvocationHandler constructor                                    
+  /* ------------------------------------------------------------------------ */
+  /**
+   * Creates an instance called by the specified skeleton.
+   *
+   * @param s The caller.
+   */
+  public DefaultInvocationHandler(Skeleton s)
+  {
+    this._s = s;
+  }
+  
+  /* ------------------------------------------------------------------------ */
+  /* invoke method                                    
+  /* ------------------------------------------------------------------------ */
+  /**
+   * Invoked when no ReturnType or MethodCall Handlers are defined.
+   * 
+   * @param target     The target object that was invoked. 
+   * @param method     The method that was invoked.
+   * @param arguments  The arguments that were passed.
+   * @return           A proxy or null.
+   * @throws Throwable
+   */
+  public Object invoke(Object target, Method method, Object[] arguments)
+      throws Throwable
+  {
+    Class<?> returnType = method.getReturnType();
+    Object obj = null;
+    
+    if (returnType.isInterface())
+    {
+      obj = createProxy(new Class[] { returnType });
+    }
+    else 
+    {
+      try
+      {
+        obj = returnType.newInstance();
+      }
+      catch (Exception e)
+      {
+        // if this occurs then assume no default constructor was visible.
+      }
+    }
+    
+    return obj;
+  }
+  
+  /* ------------------------------------------------------------------------ */
+  /* createProxy method                                    
+  /* ------------------------------------------------------------------------ */
+  /**
+   * Creates and returns a proxy backed by the associated skeleton, that 
+   * implements the specified interfaces. Null is returned if the return
+   * type array contains non interfaces.
+   * 
+   * @param returnTypes The classes.
+   * @return            The proxy or null.
+   */
+  public Object createProxy(Class<?> ... returnTypes)
+  {
+    Object result = null;
+    
+    boolean allInterfaces = true;
+    for(int i = 0; (allInterfaces && i<returnTypes.length); i++)
+       allInterfaces = returnTypes[i].isInterface();
+    
+    if (allInterfaces)
+    {
+      result = _s.createMock(returnTypes);
+    }
+    return result;
+  }
+}

Propchange: incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/DefaultInvocationHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/DefaultMethodCallHandlers.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/DefaultMethodCallHandlers.java?rev=822565&r1=822564&r2=822565&view=diff
==============================================================================
--- incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/DefaultMethodCallHandlers.java (original)
+++ incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/DefaultMethodCallHandlers.java Wed Oct  7 03:00:43 2009
@@ -1,138 +1,138 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.aries.unittest.mocks;
-
-/**
- * <p>This class contains method call handlers for some default method handling.
- * </p>
- *
- * <p>This class provides handlers for the toString, equals and hashCode
- *   methods. They reproduce the default Object implementations for dynamic
- *   mock objects, these can be overridden.
- * </p>
- */
-public class DefaultMethodCallHandlers
-{
-  /** A MethodCall representing the equals method */
-  private static MethodCall _equals;
-  /** A MethodCall representing the toString method */
-  private static MethodCall _toString;
-  /** A MethodCall representing the hashCode method */
-  private static MethodCall _hashCode;
-
-  /* ------------------------------------------------------------------------ */
-  /* static initializer
-  /* ------------------------------------------------------------------------ */
-  static
-  {
-    _equals = new MethodCall(Object.class, "equals", new Object[] {Object.class});
-    _toString = new MethodCall(Object.class, "toString", new Object[0]);
-    _hashCode = new MethodCall(Object.class, "hashCode", new Object[0]);
-  }
-
-  /**
-   * The Default MethodCallHandler for the equals method, performs an == check.
-   */
-  public static final MethodCallHandler EQUALS_HANDLER = new MethodCallHandler()
-  {
-    public Object handle(MethodCall methodCall, Skeleton parent) throws Exception
-    {
-      Object obj = methodCall.getInvokedObject();
-      Object toObj = methodCall.getArguments()[0];
-      
-      if (toObj == null) return false;
-      
-      if(parent.getTemplateObject() != null){
-        try {
-          if(Skeleton.isSkeleton(toObj) &&Skeleton.getSkeleton(toObj).getTemplateObject() != null){
-            return parent.getTemplateObject().equals(Skeleton.getSkeleton(toObj).getTemplateObject());
-          } else {
-            return false;
-          }
-        } catch (IllegalArgumentException iae) {
-          return parent.getTemplateObject().equals(toObj);
-        }
-      }
-        
-
-      return obj == toObj ? Boolean.TRUE : Boolean.FALSE;
-    }
-  };
-
-  /**
-   * The Default MethodCallHandler for the toString method, reproduces
-   * <classname>@<hashCode>
-   */
-  public static final MethodCallHandler TOSTRING_HANDLER = new MethodCallHandler()
-  {
-    public Object handle(MethodCall methodCall, Skeleton parent) throws Exception
-    {
-      if(parent.getTemplateObject() != null)
-        return parent.getTemplateObject().toString();
-      Object obj = methodCall.getInvokedObject();
-      return obj.getClass().getName() + "@" + System.identityHashCode(obj);
-    }
-  };
-
-  /**
-   * The Default MethodCallHandler for the hashCode method, returns the
-   * identity hashCode.
-   */
-  public static final MethodCallHandler HASHCODE_HANDLER = new MethodCallHandler()
-  {
-    public Object handle(MethodCall methodCall, Skeleton parent) throws Exception
-    {
-      if(parent.getTemplateObject() != null)
-        return parent.getTemplateObject().hashCode();
-      
-      return Integer.valueOf(System.identityHashCode(methodCall.getInvokedObject()));
-    }
-  };
-
-  /* ------------------------------------------------------------------------ */
-  /* registerDefaultHandlers method
-  /* ------------------------------------------------------------------------ */
-  /**
-   * This method registers the DefaultMethodCall Handlers with the specified
-   * skeleton.
-   *
-   * @param s a skeleton
-   */
-  public static void registerDefaultHandlers(Skeleton s)
-  {
-    s.registerMethodCallHandler(_equals, EQUALS_HANDLER);
-    s.registerMethodCallHandler(_toString, TOSTRING_HANDLER);
-    s.registerMethodCallHandler(_hashCode, HASHCODE_HANDLER);
-  }
-
-  /* ------------------------------------------------------------------------ */
-  /* isDefaultMethodCall method
-  /* ------------------------------------------------------------------------ */
-  /**
-   * This method returns true if and only if the specified call represents a
-   * default method call.
-   *
-   * @param call the call
-   * @return see above.
-   */
-  public static boolean isDefaultMethodCall(MethodCall call)
-  {
-    return _toString.equals(call) || _equals.equals(call) || _hashCode.equals(call);
-  }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.unittest.mocks;
+
+/**
+ * <p>This class contains method call handlers for some default method handling.
+ * </p>
+ *
+ * <p>This class provides handlers for the toString, equals and hashCode
+ *   methods. They reproduce the default Object implementations for dynamic
+ *   mock objects, these can be overridden.
+ * </p>
+ */
+public class DefaultMethodCallHandlers
+{
+  /** A MethodCall representing the equals method */
+  private static MethodCall _equals;
+  /** A MethodCall representing the toString method */
+  private static MethodCall _toString;
+  /** A MethodCall representing the hashCode method */
+  private static MethodCall _hashCode;
+
+  /* ------------------------------------------------------------------------ */
+  /* static initializer
+  /* ------------------------------------------------------------------------ */
+  static
+  {
+    _equals = new MethodCall(Object.class, "equals", new Object[] {Object.class});
+    _toString = new MethodCall(Object.class, "toString", new Object[0]);
+    _hashCode = new MethodCall(Object.class, "hashCode", new Object[0]);
+  }
+
+  /**
+   * The Default MethodCallHandler for the equals method, performs an == check.
+   */
+  public static final MethodCallHandler EQUALS_HANDLER = new MethodCallHandler()
+  {
+    public Object handle(MethodCall methodCall, Skeleton parent) throws Exception
+    {
+      Object obj = methodCall.getInvokedObject();
+      Object toObj = methodCall.getArguments()[0];
+      
+      if (toObj == null) return false;
+      
+      if(parent.getTemplateObject() != null){
+        try {
+          if(Skeleton.isSkeleton(toObj) &&Skeleton.getSkeleton(toObj).getTemplateObject() != null){
+            return parent.getTemplateObject().equals(Skeleton.getSkeleton(toObj).getTemplateObject());
+          } else {
+            return false;
+          }
+        } catch (IllegalArgumentException iae) {
+          return parent.getTemplateObject().equals(toObj);
+        }
+      }
+        
+
+      return obj == toObj ? Boolean.TRUE : Boolean.FALSE;
+    }
+  };
+
+  /**
+   * The Default MethodCallHandler for the toString method, reproduces
+   * <classname>@<hashCode>
+   */
+  public static final MethodCallHandler TOSTRING_HANDLER = new MethodCallHandler()
+  {
+    public Object handle(MethodCall methodCall, Skeleton parent) throws Exception
+    {
+      if(parent.getTemplateObject() != null)
+        return parent.getTemplateObject().toString();
+      Object obj = methodCall.getInvokedObject();
+      return obj.getClass().getName() + "@" + System.identityHashCode(obj);
+    }
+  };
+
+  /**
+   * The Default MethodCallHandler for the hashCode method, returns the
+   * identity hashCode.
+   */
+  public static final MethodCallHandler HASHCODE_HANDLER = new MethodCallHandler()
+  {
+    public Object handle(MethodCall methodCall, Skeleton parent) throws Exception
+    {
+      if(parent.getTemplateObject() != null)
+        return parent.getTemplateObject().hashCode();
+      
+      return Integer.valueOf(System.identityHashCode(methodCall.getInvokedObject()));
+    }
+  };
+
+  /* ------------------------------------------------------------------------ */
+  /* registerDefaultHandlers method
+  /* ------------------------------------------------------------------------ */
+  /**
+   * This method registers the DefaultMethodCall Handlers with the specified
+   * skeleton.
+   *
+   * @param s a skeleton
+   */
+  public static void registerDefaultHandlers(Skeleton s)
+  {
+    s.registerMethodCallHandler(_equals, EQUALS_HANDLER);
+    s.registerMethodCallHandler(_toString, TOSTRING_HANDLER);
+    s.registerMethodCallHandler(_hashCode, HASHCODE_HANDLER);
+  }
+
+  /* ------------------------------------------------------------------------ */
+  /* isDefaultMethodCall method
+  /* ------------------------------------------------------------------------ */
+  /**
+   * This method returns true if and only if the specified call represents a
+   * default method call.
+   *
+   * @param call the call
+   * @return see above.
+   */
+  public static boolean isDefaultMethodCall(MethodCall call)
+  {
+    return _toString.equals(call) || _equals.equals(call) || _hashCode.equals(call);
+  }
+}

Propchange: incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/DefaultMethodCallHandlers.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/DefaultReturnTypeHandlers.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/DefaultReturnTypeHandlers.java?rev=822565&r1=822564&r2=822565&view=diff
==============================================================================
--- incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/DefaultReturnTypeHandlers.java (original)
+++ incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/DefaultReturnTypeHandlers.java Wed Oct  7 03:00:43 2009
@@ -1,145 +1,145 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.aries.unittest.mocks;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * <p>This class contains some return type handlers that provides some default behavior.</p>
- */
-public class DefaultReturnTypeHandlers
-{
-  /** A handler for Longs */
-  public static final ReturnTypeHandler LONG_HANDLER = new ReturnTypeHandler() {
-    public Object handle(Class<?> class1, Skeleton parent)
-    {
-      return Long.valueOf(0);
-    }
-  };
-  /** A handler for Integers */
-  public static final ReturnTypeHandler INT_HANDLER = new ReturnTypeHandler() {
-    public Object handle(Class<?> class1, Skeleton parent)
-    {
-      return Integer.valueOf(0);
-    }
-  };
-  /** A handler for Shorts */
-  public static final ReturnTypeHandler SHORT_HANDLER = new ReturnTypeHandler() {
-    public Object handle(Class<?> class1, Skeleton parent)
-    {
-      return Short.valueOf((short)0);
-    }
-  };
-  /** A handler for Bytes */
-  public static final ReturnTypeHandler BYTE_HANDLER = new ReturnTypeHandler() {
-    public Object handle(Class<?> class1, Skeleton parent)
-    {
-      return Byte.valueOf((byte)0);
-    }
-  };
-  /** A handler for Characters */
-  public static final ReturnTypeHandler CHAR_HANDLER = new ReturnTypeHandler() {
-    public Object handle(Class<?> class1, Skeleton parent)
-    {
-      return Character.valueOf(' ');
-    }
-  };
-  /** A handler for Strings */
-  public static final ReturnTypeHandler STRING_HANDLER = new ReturnTypeHandler() {
-    public Object handle(Class<?> class1, Skeleton parent)
-    {
-      return "";
-    }
-  };
-  /** A handler for Lists */
-  public static final ReturnTypeHandler LIST_HANDLER = new ReturnTypeHandler() {
-    public Object handle(Class<?> class1, Skeleton parent)
-    {
-      return new ArrayList<Object>();
-    }
-  };
-  /** A handler for Maps */
-  public static final ReturnTypeHandler MAP_HANDLER = new ReturnTypeHandler() {
-    public Object handle(Class<?> class1, Skeleton parent)
-    {
-      return new HashMap<Object,Object>();
-    }
-  };
-  /** A handler for Setss */
-  public static final ReturnTypeHandler SET_HANDLER = new ReturnTypeHandler() {
-    public Object handle(Class<?> class1, Skeleton parent)
-    {
-      return new HashSet<Object>();
-    }
-  };
-  /** A handler for Floats */
-  public static final ReturnTypeHandler FLOAT_HANDLER = new ReturnTypeHandler() {
-    public Object handle(Class<?> class1, Skeleton parent)
-    {
-      return new Float(0.0f);
-    }
-  };
-  /** A handler for Doubles */
-  public static final ReturnTypeHandler DOUBLE_HANDLER = new ReturnTypeHandler() {
-    public Object handle(Class<?> class1, Skeleton parent)
-    {
-      return new Double(0.0d);
-    }
-  };
-  /** A handler for Booleans */
-  public static final ReturnTypeHandler BOOLEAN_HANDLER = new ReturnTypeHandler() {
-    public Object handle(Class<?> class1, Skeleton parent)
-    {
-      return Boolean.FALSE;
-    }
-  };
-  /**
-   * Register all the default handlers against the specified skeleton.
-   * 
-   * @param s the skeleton
-   */
-  public static void registerDefaultHandlers(Skeleton s)
-  {
-    s.registerReturnTypeHandler(Double.class, DOUBLE_HANDLER);
-    s.registerReturnTypeHandler(Float.class, FLOAT_HANDLER);
-    s.registerReturnTypeHandler(Long.class, LONG_HANDLER);
-    s.registerReturnTypeHandler(Integer.class, INT_HANDLER);
-    s.registerReturnTypeHandler(Short.class, SHORT_HANDLER);
-    s.registerReturnTypeHandler(Byte.class, BYTE_HANDLER);
-    s.registerReturnTypeHandler(Boolean.class, BOOLEAN_HANDLER);
-    s.registerReturnTypeHandler(Character.class, CHAR_HANDLER);
-    s.registerReturnTypeHandler(String.class, STRING_HANDLER);
-    s.registerReturnTypeHandler(List.class, LIST_HANDLER);
-    s.registerReturnTypeHandler(Map.class, MAP_HANDLER);
-    s.registerReturnTypeHandler(Set.class, SET_HANDLER);
-    s.registerReturnTypeHandler(double.class, DOUBLE_HANDLER);
-    s.registerReturnTypeHandler(float.class, FLOAT_HANDLER);
-    s.registerReturnTypeHandler(long.class, LONG_HANDLER);
-    s.registerReturnTypeHandler(int.class, INT_HANDLER);
-    s.registerReturnTypeHandler(short.class, SHORT_HANDLER);
-    s.registerReturnTypeHandler(byte.class, BYTE_HANDLER);
-    s.registerReturnTypeHandler(char.class, CHAR_HANDLER);
-    s.registerReturnTypeHandler(boolean.class, BOOLEAN_HANDLER);
-  }
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.unittest.mocks;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * <p>This class contains some return type handlers that provides some default behavior.</p>
+ */
+public class DefaultReturnTypeHandlers
+{
+  /** A handler for Longs */
+  public static final ReturnTypeHandler LONG_HANDLER = new ReturnTypeHandler() {
+    public Object handle(Class<?> class1, Skeleton parent)
+    {
+      return Long.valueOf(0);
+    }
+  };
+  /** A handler for Integers */
+  public static final ReturnTypeHandler INT_HANDLER = new ReturnTypeHandler() {
+    public Object handle(Class<?> class1, Skeleton parent)
+    {
+      return Integer.valueOf(0);
+    }
+  };
+  /** A handler for Shorts */
+  public static final ReturnTypeHandler SHORT_HANDLER = new ReturnTypeHandler() {
+    public Object handle(Class<?> class1, Skeleton parent)
+    {
+      return Short.valueOf((short)0);
+    }
+  };
+  /** A handler for Bytes */
+  public static final ReturnTypeHandler BYTE_HANDLER = new ReturnTypeHandler() {
+    public Object handle(Class<?> class1, Skeleton parent)
+    {
+      return Byte.valueOf((byte)0);
+    }
+  };
+  /** A handler for Characters */
+  public static final ReturnTypeHandler CHAR_HANDLER = new ReturnTypeHandler() {
+    public Object handle(Class<?> class1, Skeleton parent)
+    {
+      return Character.valueOf(' ');
+    }
+  };
+  /** A handler for Strings */
+  public static final ReturnTypeHandler STRING_HANDLER = new ReturnTypeHandler() {
+    public Object handle(Class<?> class1, Skeleton parent)
+    {
+      return "";
+    }
+  };
+  /** A handler for Lists */
+  public static final ReturnTypeHandler LIST_HANDLER = new ReturnTypeHandler() {
+    public Object handle(Class<?> class1, Skeleton parent)
+    {
+      return new ArrayList<Object>();
+    }
+  };
+  /** A handler for Maps */
+  public static final ReturnTypeHandler MAP_HANDLER = new ReturnTypeHandler() {
+    public Object handle(Class<?> class1, Skeleton parent)
+    {
+      return new HashMap<Object,Object>();
+    }
+  };
+  /** A handler for Setss */
+  public static final ReturnTypeHandler SET_HANDLER = new ReturnTypeHandler() {
+    public Object handle(Class<?> class1, Skeleton parent)
+    {
+      return new HashSet<Object>();
+    }
+  };
+  /** A handler for Floats */
+  public static final ReturnTypeHandler FLOAT_HANDLER = new ReturnTypeHandler() {
+    public Object handle(Class<?> class1, Skeleton parent)
+    {
+      return new Float(0.0f);
+    }
+  };
+  /** A handler for Doubles */
+  public static final ReturnTypeHandler DOUBLE_HANDLER = new ReturnTypeHandler() {
+    public Object handle(Class<?> class1, Skeleton parent)
+    {
+      return new Double(0.0d);
+    }
+  };
+  /** A handler for Booleans */
+  public static final ReturnTypeHandler BOOLEAN_HANDLER = new ReturnTypeHandler() {
+    public Object handle(Class<?> class1, Skeleton parent)
+    {
+      return Boolean.FALSE;
+    }
+  };
+  /**
+   * Register all the default handlers against the specified skeleton.
+   * 
+   * @param s the skeleton
+   */
+  public static void registerDefaultHandlers(Skeleton s)
+  {
+    s.registerReturnTypeHandler(Double.class, DOUBLE_HANDLER);
+    s.registerReturnTypeHandler(Float.class, FLOAT_HANDLER);
+    s.registerReturnTypeHandler(Long.class, LONG_HANDLER);
+    s.registerReturnTypeHandler(Integer.class, INT_HANDLER);
+    s.registerReturnTypeHandler(Short.class, SHORT_HANDLER);
+    s.registerReturnTypeHandler(Byte.class, BYTE_HANDLER);
+    s.registerReturnTypeHandler(Boolean.class, BOOLEAN_HANDLER);
+    s.registerReturnTypeHandler(Character.class, CHAR_HANDLER);
+    s.registerReturnTypeHandler(String.class, STRING_HANDLER);
+    s.registerReturnTypeHandler(List.class, LIST_HANDLER);
+    s.registerReturnTypeHandler(Map.class, MAP_HANDLER);
+    s.registerReturnTypeHandler(Set.class, SET_HANDLER);
+    s.registerReturnTypeHandler(double.class, DOUBLE_HANDLER);
+    s.registerReturnTypeHandler(float.class, FLOAT_HANDLER);
+    s.registerReturnTypeHandler(long.class, LONG_HANDLER);
+    s.registerReturnTypeHandler(int.class, INT_HANDLER);
+    s.registerReturnTypeHandler(short.class, SHORT_HANDLER);
+    s.registerReturnTypeHandler(byte.class, BYTE_HANDLER);
+    s.registerReturnTypeHandler(char.class, CHAR_HANDLER);
+    s.registerReturnTypeHandler(boolean.class, BOOLEAN_HANDLER);
+  }
 }
\ No newline at end of file

Propchange: incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/DefaultReturnTypeHandlers.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/ExceptionListener.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/ExceptionListener.java?rev=822565&r1=822564&r2=822565&view=diff
==============================================================================
--- incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/ExceptionListener.java (original)
+++ incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/ExceptionListener.java Wed Oct  7 03:00:43 2009
@@ -1,37 +1,37 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.aries.unittest.mocks;
-
-/**
- * <p>This class receives notification that an exception has been thrown from
- *   a mock object.
- * </p>
- */
-public interface ExceptionListener
-{
-  /* ------------------------------------------------------------------------ */
-  /* exceptionNotification method                                    
-  /* ------------------------------------------------------------------------ */
-  /**
-   * This method is called when an exception has been thrown from a mock.
-   * 
-   * @param t the exception or error thrown.
-   */
-  public void exceptionNotification(Throwable t);
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.unittest.mocks;
+
+/**
+ * <p>This class receives notification that an exception has been thrown from
+ *   a mock object.
+ * </p>
+ */
+public interface ExceptionListener
+{
+  /* ------------------------------------------------------------------------ */
+  /* exceptionNotification method                                    
+  /* ------------------------------------------------------------------------ */
+  /**
+   * This method is called when an exception has been thrown from a mock.
+   * 
+   * @param t the exception or error thrown.
+   */
+  public void exceptionNotification(Throwable t);
+}

Propchange: incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/ExceptionListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/MethodCall.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/MethodCall.java?rev=822565&r1=822564&r2=822565&view=diff
==============================================================================
--- incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/MethodCall.java (original)
+++ incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/MethodCall.java Wed Oct  7 03:00:43 2009
@@ -1,573 +1,573 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.aries.unittest.mocks;
-
-import java.lang.reflect.Proxy;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * <p>This class represents a method call that has been or is expected to be 
- *   made. It encapsulates the class that the call was made on, the method
- *   that was invoked and the arguments passed.</p>
- */
-public final class MethodCall
-{
-  /** An empty object array */
-  private static Object[] EMPTY_OBJECT_ARRAY = new Object[0];
-  /** The name of the class invoked */
-  private String _className;
-  /** The array of interfaces implemented by the class */
-  private Class<?>[] _interfaces = new Class[0];
-  /** The method invoked */
-  private String _methodName;
-  /** The arguments passed */
-  private Object[] _arguments = EMPTY_OBJECT_ARRAY;
-  /** The object invoked */
-  private Object _invokedObject;
-  /** A list of comparators to use, instead of the objects .equals methods */
-  private static Map<Class<?>, Comparator<?>> equalsHelpers = new HashMap<Class<?>, Comparator<?>>();
-
-  /* ------------------------------------------------------------------------ */
-  /* MethodCall method                                    
-  /* ------------------------------------------------------------------------ */
-  /**
-   * This constructor allows a MethodCall to be created when the class can be
-   * located statically, rather than dynamically.
-   * 
-   * @param clazz      The class.
-   * @param methodName The method name.
-   * @param arguments  The arguments.
-   */
-  public MethodCall(Class<?> clazz, String methodName, Object ... arguments)
-  {
-    _className = clazz.getName();
-    _methodName = methodName;
-    _arguments = arguments;
-  }
-
-  /* ------------------------------------------------------------------------ */
-  /* MethodCall method                                    
-  /* ------------------------------------------------------------------------ */
-  /**
-   * This method is used by the Skeleton in order create an instance of a 
-   * MethodCall representing an invoked interface.
-   * 
-   * NOTE: If possible changing this so the constructor does not need to be
-   * default visibility would be good, given the problems with default 
-   * visibility. 
-   * 
-   * @param invokedObject The object that was invoked.
-   * @param methodName    The name of the method invoked.
-   * @param arguments     The arguments passed.
-   */
-  MethodCall(Object invokedObject, String methodName, Object ... arguments)
-  {
-    _className = invokedObject.getClass().getName();
-    _interfaces = invokedObject.getClass().getInterfaces();
-    _methodName = methodName;
-
-    this._arguments = (arguments == null) ? EMPTY_OBJECT_ARRAY : arguments;
-    
-    _invokedObject = invokedObject;
-  }
-
-  /* ------------------------------------------------------------------------ */
-  /* getArguments method                                    
-  /* ------------------------------------------------------------------------ */
-  /**
-   * This method returns the arguments.
-   * 
-   * @return The arguments.
-   */
-  public Object[] getArguments()
-  {
-    return _arguments;
-  }
-
-  /* ------------------------------------------------------------------------ */
-  /* getClassName method                                    
-  /* ------------------------------------------------------------------------ */
-  /**
-   * Returns the name of the class the method was invoked or was defined on.
-   * 
-   * @return the classname.
-   */
-  public String getClassName()
-  {
-    return _className;
-  }
-
-  /* ------------------------------------------------------------------------ */
-  /* getMethodName method                                    
-  /* ------------------------------------------------------------------------ */
-  /**
-   * Returns the name of the method that was (or will be) invoked.
-   * 
-   * @return the method name
-   */
-  public String getMethodName()
-  {
-    return _methodName;
-  }
-
-  /* ------------------------------------------------------------------------ */
-  /* checkClassName method                                    
-  /* ------------------------------------------------------------------------ */
-  /**
-   * This method checks that the class names specified in the method call are
-   * compatible, i.e. one is a superclass of the other.
-   * 
-   * @param one The first method call.
-   * @param two The second method call.
-   * @return    true if the classes can be assigned to each other.
-   */
-  private boolean checkClassName(MethodCall one, MethodCall two)
-  {
-    // TODO make this stuff work better.
-    if (one._className.equals("java.lang.Object"))
-    {
-      return true;
-    }
-    else if (two._className.equals("java.lang.Object"))
-    {
-      return true;
-    }
-    else if (one._className.equals(two._className))
-    {
-      return true;
-    }
-    else
-    {
-      // check the other class name is one of the implemented interfaces
-      boolean result = false;
-        
-      for (int i = 0; i < two._interfaces.length; i++)
-      {
-        if (two._interfaces[i].getName().equals(one._className))
-        {
-          result = true;
-          break;
-        }
-      }
-        
-      if (!result)
-      {
-        for (int i = 0; i < one._interfaces.length; i++)
-        {
-          if (one._interfaces[i].getName().equals(two._className))
-          {
-            result = true;
-            break;
-          }
-        }
-      }
-        
-      return result;
-    }
-  }
-  
-  /* ------------------------------------------------------------------------ */
-  /* equals method                                    
-  /* ------------------------------------------------------------------------ */
-  /**
-   * Returns true if and only if the two object represent the same call.
-   * 
-   * @param obj The object to be compared.
-   * @return    true if the specified object is the same as this.
-   */
-  @Override
-  public boolean equals(Object obj)
-  {
-
-    if (obj == null) return false;
-
-    if (obj == this) return true;
-    
-    if (obj instanceof MethodCall)
-    {
-      MethodCall other = (MethodCall)obj;
-
-      if (!checkClassName(this, other)) 
-      {
-        return false;
-      }
-      
-      if (!other._methodName.equals(this._methodName)) return false;
-      if (other._arguments.length != this._arguments.length) return false;
-      
-      for (int i = 0; i < this._arguments.length; i++)
-      {
-        boolean thisArgNull = this._arguments[i] == null;
-        boolean otherArgClazz = other._arguments[i] instanceof Class;
-        boolean otherArgNull = other._arguments[i] == null;
-        boolean thisArgClazz = this._arguments[i] instanceof Class;
-        
-        if (thisArgNull)
-        {
-          if (otherArgNull)
-          {
-            // This is OK
-          }
-          else if (otherArgClazz)
-          {
-            // This is also OK
-          }
-          else
-          {
-            return false;
-          }
-          // this argument is OK.
-        }
-        else if (otherArgNull)
-        {
-          if (thisArgClazz)
-          {
-            // This is OK
-          }
-          else
-          {
-            return false;
-          }
-          // this argument is OK.
-        }
-        else if (otherArgClazz)
-        {
-          if (thisArgClazz)
-          {
-            Class<?> otherArgClass = (Class<?>) other._arguments[i];
-            Class<?> thisArgClass = (Class<?>) this._arguments[i];
-          
-            if (otherArgClass.equals(Class.class) || thisArgClass.equals(Class.class))
-            {
-              // do nothing
-            } else if (!(otherArgClass.isAssignableFrom(thisArgClass) ||
-                thisArgClass.isAssignableFrom(otherArgClass)))
-            {
-              return false;
-            }
-          }
-          else
-          {
-            Class<?> clazz = (Class<?>)other._arguments[i];
-            if (clazz.isPrimitive())
-            {
-              if (clazz.equals(byte.class))
-              {
-                return this._arguments[i].getClass().equals(Byte.class);
-              }
-              else if (clazz.equals(boolean.class))
-              {
-                return this._arguments[i].getClass().equals(Boolean.class);
-              }
-              else if (clazz.equals(short.class))
-              {
-                return this._arguments[i].getClass().equals(Short.class);
-              }
-              else if (clazz.equals(char.class))
-              {
-                return this._arguments[i].getClass().equals(Character.class);
-              }
-              else if (clazz.equals(int.class))
-              {
-                return this._arguments[i].getClass().equals(Integer.class);
-              }
-              else if (clazz.equals(long.class))
-              {
-                return this._arguments[i].getClass().equals(Long.class);
-              }
-              else if (clazz.equals(float.class))
-              {
-                return this._arguments[i].getClass().equals(Float.class);
-              }
-              else if (clazz.equals(double.class))
-              {
-                return this._arguments[i].getClass().equals(Double.class);
-              }
-            }
-            else
-            {
-              if (!clazz.isInstance(this._arguments[i]))
-              {
-                return false;
-              }
-            }
-          }
-        }
-        else if (thisArgClazz)
-        {
-          Class<?> clazz = (Class<?>)this._arguments[i];
-          if (clazz.isPrimitive())
-          {
-            if (clazz.equals(byte.class))
-            {
-              return other._arguments[i].getClass().equals(Byte.class);
-            }
-            else if (clazz.equals(boolean.class))
-            {
-              return other._arguments[i].getClass().equals(Boolean.class);
-            }
-            else if (clazz.equals(short.class))
-            {
-              return other._arguments[i].getClass().equals(Short.class);
-            }
-            else if (clazz.equals(char.class))
-            {
-              return other._arguments[i].getClass().equals(Character.class);
-            }
-            else if (clazz.equals(int.class))
-            {
-              return other._arguments[i].getClass().equals(Integer.class);
-            }
-            else if (clazz.equals(long.class))
-            {
-              return other._arguments[i].getClass().equals(Long.class);
-            }
-            else if (clazz.equals(float.class))
-            {
-              return other._arguments[i].getClass().equals(Float.class);
-            }
-            else if (clazz.equals(double.class))
-            {
-              return other._arguments[i].getClass().equals(Double.class);
-            }
-          }
-          else
-          {
-            if (!clazz.isInstance(other._arguments[i]))
-            {
-              return false;
-            }
-          }
-        }
-        else if (this._arguments[i] instanceof Object[] && other._arguments[i] instanceof Object[])
-        {
-          return equals((Object[])this._arguments[i], (Object[])other._arguments[i]);
-        }
-        else 
-        {
-          int result = compareUsingComparators(this._arguments[i], other._arguments[i]);
-          
-          if (result == 0) continue;
-          else if (result == 1) return false;
-          else if (!!!this._arguments[i].equals(other._arguments[i])) return false;
-        }
-      }
-    }
-
-    return true;
-  }
-
-  /**
-   * Compare two arrays calling out to the custom comparators and handling
-   * AtomicIntegers nicely.
-   * 
-   * TODO remove the special casing for AtomicInteger.
-   * 
-   * @param arr1 
-   * @param arr2
-   * @return true if the arrays are equals, false otherwise.
-   */
-  private boolean equals(Object[] arr1, Object[] arr2)
-  {
-    if (arr1.length != arr2.length) return false;
-    
-    for (int k = 0; k < arr1.length; k++) {
-      if (arr1[k] == arr2[k]) continue;
-      if (arr1[k] == null && arr2[k] != null) return false;
-      if (arr1[k] != null && arr2[k] == null) return false;
-      
-      int result = compareUsingComparators(arr1[k], arr2[k]);
-      
-      if (result == 0) continue;
-      else if (result == 1) return false;
-      
-      if (arr1[k] instanceof AtomicInteger && arr2[k] instanceof AtomicInteger && 
-          ((AtomicInteger)arr1[k]).intValue() == ((AtomicInteger)arr2[k]).intValue()) 
-        continue;
-
-      if (!!!arr1[k].equals(arr2[k])) return false;
-
-    }
-    
-    return true;
-  }
-  
-  /**
-   * Attempt to do the comparison using the comparators. This logic returns:
-   * 
-   * <ul>
-   *   <li>0 if they are equal</li>
-   *   <li>1 if they are not equal</li>
-   *   <li>-1 no comparison was run</li>
-   * </ul>
-   * 
-   * @param o1 The first object.
-   * @param o2 The second object.
-   * @return 0, 1 or -1 depending on whether the objects were equal, not equal or no comparason was run.
-   */
-  private int compareUsingComparators(Object o1, Object o2)
-  {
-    if (o1.getClass() == o2.getClass()) {
-      @SuppressWarnings("unchecked")
-      Comparator<Object> compare = (Comparator<Object>) equalsHelpers.get(o1.getClass());
-      
-      if (compare != null) {
-        if (compare.compare(o1, o2) == 0) return 0;
-        else return 1;
-      }
-    }
-    
-    return -1;
-  }
-  
-  /* ------------------------------------------------------------------------ */
-  /* hashCode method                                    
-  /* ------------------------------------------------------------------------ */
-  /**
-   * Returns the hashCode (obtained by returning the hashCode of the 
-   * methodName).
-   * 
-   * @return The hashCode
-   */
-  @Override
-  public int hashCode()
-  {
-    return _methodName.hashCode();
-  }
-
-  /* ------------------------------------------------------------------------ */
-  /* toString method                                    
-  /* ------------------------------------------------------------------------ */
-  /**
-   * Returns a string representation of the method call.
-   * 
-   * @return string representation.
-   */
-  @Override
-  public String toString()
-  {
-    StringBuffer buffer = new StringBuffer();
-    buffer.append(this._className);
-    buffer.append('.');
-    buffer.append(this._methodName);
-    buffer.append("(");
-
-    for (int i = 0; i < this._arguments.length; i++)
-    {
-      if (this._arguments[i] != null)
-      {
-        if (this._arguments[i] instanceof Class)
-        {
-          buffer.append(((Class<?>)this._arguments[i]).getName());
-        }
-        else if (Proxy.isProxyClass(this._arguments[i].getClass()))
-        {
-          // If the object is a dynamic proxy, just use the proxy class name to avoid calling toString on the proxy
-          buffer.append(this._arguments[i].getClass().getName());
-        }
-        else if (this._arguments[i] instanceof Object[])
-        {
-          buffer.append(Arrays.toString((Object[])this._arguments[i]));
-        }
-        else
-        {  
-          buffer.append(String.valueOf(this._arguments[i]));
-        }
-      } 
-      else
-      {  
-        buffer.append("null");
-      }
-
-      if (i + 1 < this._arguments.length)
-        buffer.append(", ");
-    }
-
-    buffer.append(")");
-    String string = buffer.toString();
-    return string;
-  }
-
-  /* ------------------------------------------------------------------------ */
-  /* getInterfaces method                                    
-  /* ------------------------------------------------------------------------ */
-  /**
-   * This method returns the list of interfaces implemented by the class that
-   * was called.
-   * 
-   * @return Returns the interfaces.
-   */
-  public Class<?>[] getInterfaces()
-  {
-    return this._interfaces;
-  }
-  
-  /* ------------------------------------------------------------------------ */
-  /* getInvokedObject method                                    
-  /* ------------------------------------------------------------------------ */
-  /**
-   * This method returns the invoked object.
-   * 
-   * @return The object that was invoked or null if an expected call.
-   */
-  public Object getInvokedObject()
-  {
-    return _invokedObject;
-  }
-  
-  /* ------------------------------------------------------------------------ */
-  /* registerEqualsHelper method                                    
-  /* ------------------------------------------------------------------------ */
-  /**
-   * The native equals for an object may not provide the behaviour required by
-   * the tests. As an example AtomicInteger does not define a .equals, but tests
-   * may wish to compare it being passed in a method call for equality. This
-   * method allows a Comparator to be specified for any type and the Comparator
-   * will be used to determine equality in place of the .equals method.
-   * 
-   * <p>The Comparator must not throw exceptions, and must return 0 for equality
-   *   or any other integer for inequality.
-   * </p>
-   * 
-   * @param <T>        the type of the class and comparator.
-   * @param type       the type of the class for which the comparator will be called.
-   * @param comparator the comparator to call.
-   */
-  public static <T> void registerEqualsHelper(Class<T> type, Comparator<T> comparator)
-  {
-    equalsHelpers.put(type, comparator);
-  }
-  
-  /* ------------------------------------------------------------------------ */
-  /* removeEqualsHelper method                                    
-  /* ------------------------------------------------------------------------ */
-  /**
-   * This method removes any registered comparator specified for the given type.
-   * 
-   * @param type the type to remove the comparator from.
-   */
-  public static void removeEqualsHelper(Class<?> type)
-  {
-    equalsHelpers.remove(type);
-  }
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.unittest.mocks;
+
+import java.lang.reflect.Proxy;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * <p>This class represents a method call that has been or is expected to be 
+ *   made. It encapsulates the class that the call was made on, the method
+ *   that was invoked and the arguments passed.</p>
+ */
+public final class MethodCall
+{
+  /** An empty object array */
+  private static Object[] EMPTY_OBJECT_ARRAY = new Object[0];
+  /** The name of the class invoked */
+  private String _className;
+  /** The array of interfaces implemented by the class */
+  private Class<?>[] _interfaces = new Class[0];
+  /** The method invoked */
+  private String _methodName;
+  /** The arguments passed */
+  private Object[] _arguments = EMPTY_OBJECT_ARRAY;
+  /** The object invoked */
+  private Object _invokedObject;
+  /** A list of comparators to use, instead of the objects .equals methods */
+  private static Map<Class<?>, Comparator<?>> equalsHelpers = new HashMap<Class<?>, Comparator<?>>();
+
+  /* ------------------------------------------------------------------------ */
+  /* MethodCall method                                    
+  /* ------------------------------------------------------------------------ */
+  /**
+   * This constructor allows a MethodCall to be created when the class can be
+   * located statically, rather than dynamically.
+   * 
+   * @param clazz      The class.
+   * @param methodName The method name.
+   * @param arguments  The arguments.
+   */
+  public MethodCall(Class<?> clazz, String methodName, Object ... arguments)
+  {
+    _className = clazz.getName();
+    _methodName = methodName;
+    _arguments = arguments;
+  }
+
+  /* ------------------------------------------------------------------------ */
+  /* MethodCall method                                    
+  /* ------------------------------------------------------------------------ */
+  /**
+   * This method is used by the Skeleton in order create an instance of a 
+   * MethodCall representing an invoked interface.
+   * 
+   * NOTE: If possible changing this so the constructor does not need to be
+   * default visibility would be good, given the problems with default 
+   * visibility. 
+   * 
+   * @param invokedObject The object that was invoked.
+   * @param methodName    The name of the method invoked.
+   * @param arguments     The arguments passed.
+   */
+  MethodCall(Object invokedObject, String methodName, Object ... arguments)
+  {
+    _className = invokedObject.getClass().getName();
+    _interfaces = invokedObject.getClass().getInterfaces();
+    _methodName = methodName;
+
+    this._arguments = (arguments == null) ? EMPTY_OBJECT_ARRAY : arguments;
+    
+    _invokedObject = invokedObject;
+  }
+
+  /* ------------------------------------------------------------------------ */
+  /* getArguments method                                    
+  /* ------------------------------------------------------------------------ */
+  /**
+   * This method returns the arguments.
+   * 
+   * @return The arguments.
+   */
+  public Object[] getArguments()
+  {
+    return _arguments;
+  }
+
+  /* ------------------------------------------------------------------------ */
+  /* getClassName method                                    
+  /* ------------------------------------------------------------------------ */
+  /**
+   * Returns the name of the class the method was invoked or was defined on.
+   * 
+   * @return the classname.
+   */
+  public String getClassName()
+  {
+    return _className;
+  }
+
+  /* ------------------------------------------------------------------------ */
+  /* getMethodName method                                    
+  /* ------------------------------------------------------------------------ */
+  /**
+   * Returns the name of the method that was (or will be) invoked.
+   * 
+   * @return the method name
+   */
+  public String getMethodName()
+  {
+    return _methodName;
+  }
+
+  /* ------------------------------------------------------------------------ */
+  /* checkClassName method                                    
+  /* ------------------------------------------------------------------------ */
+  /**
+   * This method checks that the class names specified in the method call are
+   * compatible, i.e. one is a superclass of the other.
+   * 
+   * @param one The first method call.
+   * @param two The second method call.
+   * @return    true if the classes can be assigned to each other.
+   */
+  private boolean checkClassName(MethodCall one, MethodCall two)
+  {
+    // TODO make this stuff work better.
+    if (one._className.equals("java.lang.Object"))
+    {
+      return true;
+    }
+    else if (two._className.equals("java.lang.Object"))
+    {
+      return true;
+    }
+    else if (one._className.equals(two._className))
+    {
+      return true;
+    }
+    else
+    {
+      // check the other class name is one of the implemented interfaces
+      boolean result = false;
+        
+      for (int i = 0; i < two._interfaces.length; i++)
+      {
+        if (two._interfaces[i].getName().equals(one._className))
+        {
+          result = true;
+          break;
+        }
+      }
+        
+      if (!result)
+      {
+        for (int i = 0; i < one._interfaces.length; i++)
+        {
+          if (one._interfaces[i].getName().equals(two._className))
+          {
+            result = true;
+            break;
+          }
+        }
+      }
+        
+      return result;
+    }
+  }
+  
+  /* ------------------------------------------------------------------------ */
+  /* equals method                                    
+  /* ------------------------------------------------------------------------ */
+  /**
+   * Returns true if and only if the two object represent the same call.
+   * 
+   * @param obj The object to be compared.
+   * @return    true if the specified object is the same as this.
+   */
+  @Override
+  public boolean equals(Object obj)
+  {
+
+    if (obj == null) return false;
+
+    if (obj == this) return true;
+    
+    if (obj instanceof MethodCall)
+    {
+      MethodCall other = (MethodCall)obj;
+
+      if (!checkClassName(this, other)) 
+      {
+        return false;
+      }
+      
+      if (!other._methodName.equals(this._methodName)) return false;
+      if (other._arguments.length != this._arguments.length) return false;
+      
+      for (int i = 0; i < this._arguments.length; i++)
+      {
+        boolean thisArgNull = this._arguments[i] == null;
+        boolean otherArgClazz = other._arguments[i] instanceof Class;
+        boolean otherArgNull = other._arguments[i] == null;
+        boolean thisArgClazz = this._arguments[i] instanceof Class;
+        
+        if (thisArgNull)
+        {
+          if (otherArgNull)
+          {
+            // This is OK
+          }
+          else if (otherArgClazz)
+          {
+            // This is also OK
+          }
+          else
+          {
+            return false;
+          }
+          // this argument is OK.
+        }
+        else if (otherArgNull)
+        {
+          if (thisArgClazz)
+          {
+            // This is OK
+          }
+          else
+          {
+            return false;
+          }
+          // this argument is OK.
+        }
+        else if (otherArgClazz)
+        {
+          if (thisArgClazz)
+          {
+            Class<?> otherArgClass = (Class<?>) other._arguments[i];
+            Class<?> thisArgClass = (Class<?>) this._arguments[i];
+          
+            if (otherArgClass.equals(Class.class) || thisArgClass.equals(Class.class))
+            {
+              // do nothing
+            } else if (!(otherArgClass.isAssignableFrom(thisArgClass) ||
+                thisArgClass.isAssignableFrom(otherArgClass)))
+            {
+              return false;
+            }
+          }
+          else
+          {
+            Class<?> clazz = (Class<?>)other._arguments[i];
+            if (clazz.isPrimitive())
+            {
+              if (clazz.equals(byte.class))
+              {
+                return this._arguments[i].getClass().equals(Byte.class);
+              }
+              else if (clazz.equals(boolean.class))
+              {
+                return this._arguments[i].getClass().equals(Boolean.class);
+              }
+              else if (clazz.equals(short.class))
+              {
+                return this._arguments[i].getClass().equals(Short.class);
+              }
+              else if (clazz.equals(char.class))
+              {
+                return this._arguments[i].getClass().equals(Character.class);
+              }
+              else if (clazz.equals(int.class))
+              {
+                return this._arguments[i].getClass().equals(Integer.class);
+              }
+              else if (clazz.equals(long.class))
+              {
+                return this._arguments[i].getClass().equals(Long.class);
+              }
+              else if (clazz.equals(float.class))
+              {
+                return this._arguments[i].getClass().equals(Float.class);
+              }
+              else if (clazz.equals(double.class))
+              {
+                return this._arguments[i].getClass().equals(Double.class);
+              }
+            }
+            else
+            {
+              if (!clazz.isInstance(this._arguments[i]))
+              {
+                return false;
+              }
+            }
+          }
+        }
+        else if (thisArgClazz)
+        {
+          Class<?> clazz = (Class<?>)this._arguments[i];
+          if (clazz.isPrimitive())
+          {
+            if (clazz.equals(byte.class))
+            {
+              return other._arguments[i].getClass().equals(Byte.class);
+            }
+            else if (clazz.equals(boolean.class))
+            {
+              return other._arguments[i].getClass().equals(Boolean.class);
+            }
+            else if (clazz.equals(short.class))
+            {
+              return other._arguments[i].getClass().equals(Short.class);
+            }
+            else if (clazz.equals(char.class))
+            {
+              return other._arguments[i].getClass().equals(Character.class);
+            }
+            else if (clazz.equals(int.class))
+            {
+              return other._arguments[i].getClass().equals(Integer.class);
+            }
+            else if (clazz.equals(long.class))
+            {
+              return other._arguments[i].getClass().equals(Long.class);
+            }
+            else if (clazz.equals(float.class))
+            {
+              return other._arguments[i].getClass().equals(Float.class);
+            }
+            else if (clazz.equals(double.class))
+            {
+              return other._arguments[i].getClass().equals(Double.class);
+            }
+          }
+          else
+          {
+            if (!clazz.isInstance(other._arguments[i]))
+            {
+              return false;
+            }
+          }
+        }
+        else if (this._arguments[i] instanceof Object[] && other._arguments[i] instanceof Object[])
+        {
+          return equals((Object[])this._arguments[i], (Object[])other._arguments[i]);
+        }
+        else 
+        {
+          int result = compareUsingComparators(this._arguments[i], other._arguments[i]);
+          
+          if (result == 0) continue;
+          else if (result == 1) return false;
+          else if (!!!this._arguments[i].equals(other._arguments[i])) return false;
+        }
+      }
+    }
+
+    return true;
+  }
+
+  /**
+   * Compare two arrays calling out to the custom comparators and handling
+   * AtomicIntegers nicely.
+   * 
+   * TODO remove the special casing for AtomicInteger.
+   * 
+   * @param arr1 
+   * @param arr2
+   * @return true if the arrays are equals, false otherwise.
+   */
+  private boolean equals(Object[] arr1, Object[] arr2)
+  {
+    if (arr1.length != arr2.length) return false;
+    
+    for (int k = 0; k < arr1.length; k++) {
+      if (arr1[k] == arr2[k]) continue;
+      if (arr1[k] == null && arr2[k] != null) return false;
+      if (arr1[k] != null && arr2[k] == null) return false;
+      
+      int result = compareUsingComparators(arr1[k], arr2[k]);
+      
+      if (result == 0) continue;
+      else if (result == 1) return false;
+      
+      if (arr1[k] instanceof AtomicInteger && arr2[k] instanceof AtomicInteger && 
+          ((AtomicInteger)arr1[k]).intValue() == ((AtomicInteger)arr2[k]).intValue()) 
+        continue;
+
+      if (!!!arr1[k].equals(arr2[k])) return false;
+
+    }
+    
+    return true;
+  }
+  
+  /**
+   * Attempt to do the comparison using the comparators. This logic returns:
+   * 
+   * <ul>
+   *   <li>0 if they are equal</li>
+   *   <li>1 if they are not equal</li>
+   *   <li>-1 no comparison was run</li>
+   * </ul>
+   * 
+   * @param o1 The first object.
+   * @param o2 The second object.
+   * @return 0, 1 or -1 depending on whether the objects were equal, not equal or no comparason was run.
+   */
+  private int compareUsingComparators(Object o1, Object o2)
+  {
+    if (o1.getClass() == o2.getClass()) {
+      @SuppressWarnings("unchecked")
+      Comparator<Object> compare = (Comparator<Object>) equalsHelpers.get(o1.getClass());
+      
+      if (compare != null) {
+        if (compare.compare(o1, o2) == 0) return 0;
+        else return 1;
+      }
+    }
+    
+    return -1;
+  }
+  
+  /* ------------------------------------------------------------------------ */
+  /* hashCode method                                    
+  /* ------------------------------------------------------------------------ */
+  /**
+   * Returns the hashCode (obtained by returning the hashCode of the 
+   * methodName).
+   * 
+   * @return The hashCode
+   */
+  @Override
+  public int hashCode()
+  {
+    return _methodName.hashCode();
+  }
+
+  /* ------------------------------------------------------------------------ */
+  /* toString method                                    
+  /* ------------------------------------------------------------------------ */
+  /**
+   * Returns a string representation of the method call.
+   * 
+   * @return string representation.
+   */
+  @Override
+  public String toString()
+  {
+    StringBuffer buffer = new StringBuffer();
+    buffer.append(this._className);
+    buffer.append('.');
+    buffer.append(this._methodName);
+    buffer.append("(");
+
+    for (int i = 0; i < this._arguments.length; i++)
+    {
+      if (this._arguments[i] != null)
+      {
+        if (this._arguments[i] instanceof Class)
+        {
+          buffer.append(((Class<?>)this._arguments[i]).getName());
+        }
+        else if (Proxy.isProxyClass(this._arguments[i].getClass()))
+        {
+          // If the object is a dynamic proxy, just use the proxy class name to avoid calling toString on the proxy
+          buffer.append(this._arguments[i].getClass().getName());
+        }
+        else if (this._arguments[i] instanceof Object[])
+        {
+          buffer.append(Arrays.toString((Object[])this._arguments[i]));
+        }
+        else
+        {  
+          buffer.append(String.valueOf(this._arguments[i]));
+        }
+      } 
+      else
+      {  
+        buffer.append("null");
+      }
+
+      if (i + 1 < this._arguments.length)
+        buffer.append(", ");
+    }
+
+    buffer.append(")");
+    String string = buffer.toString();
+    return string;
+  }
+
+  /* ------------------------------------------------------------------------ */
+  /* getInterfaces method                                    
+  /* ------------------------------------------------------------------------ */
+  /**
+   * This method returns the list of interfaces implemented by the class that
+   * was called.
+   * 
+   * @return Returns the interfaces.
+   */
+  public Class<?>[] getInterfaces()
+  {
+    return this._interfaces;
+  }
+  
+  /* ------------------------------------------------------------------------ */
+  /* getInvokedObject method                                    
+  /* ------------------------------------------------------------------------ */
+  /**
+   * This method returns the invoked object.
+   * 
+   * @return The object that was invoked or null if an expected call.
+   */
+  public Object getInvokedObject()
+  {
+    return _invokedObject;
+  }
+  
+  /* ------------------------------------------------------------------------ */
+  /* registerEqualsHelper method                                    
+  /* ------------------------------------------------------------------------ */
+  /**
+   * The native equals for an object may not provide the behaviour required by
+   * the tests. As an example AtomicInteger does not define a .equals, but tests
+   * may wish to compare it being passed in a method call for equality. This
+   * method allows a Comparator to be specified for any type and the Comparator
+   * will be used to determine equality in place of the .equals method.
+   * 
+   * <p>The Comparator must not throw exceptions, and must return 0 for equality
+   *   or any other integer for inequality.
+   * </p>
+   * 
+   * @param <T>        the type of the class and comparator.
+   * @param type       the type of the class for which the comparator will be called.
+   * @param comparator the comparator to call.
+   */
+  public static <T> void registerEqualsHelper(Class<T> type, Comparator<T> comparator)
+  {
+    equalsHelpers.put(type, comparator);
+  }
+  
+  /* ------------------------------------------------------------------------ */
+  /* removeEqualsHelper method                                    
+  /* ------------------------------------------------------------------------ */
+  /**
+   * This method removes any registered comparator specified for the given type.
+   * 
+   * @param type the type to remove the comparator from.
+   */
+  public static void removeEqualsHelper(Class<?> type)
+  {
+    equalsHelpers.remove(type);
+  }
 }
\ No newline at end of file

Propchange: incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/MethodCall.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/MethodCallHandler.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/MethodCallHandler.java?rev=822565&r1=822564&r2=822565&view=diff
==============================================================================
--- incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/MethodCallHandler.java (original)
+++ incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/MethodCallHandler.java Wed Oct  7 03:00:43 2009
@@ -1,35 +1,35 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.aries.unittest.mocks;
-
-/**
- * Implementations of this interface perform function when a method is called. The
- * handler is provided details of the method called along with the skeleton used
- * for the call.
- */
-public interface MethodCallHandler
-{
-  /**
-   * @param methodCall the method that was called
-   * @param parent     the skeleton it was called on
-   * @return           an object to be returned (optional)
-   * @throws Exception an exception in case of failure.
-   */
-  public Object handle(MethodCall methodCall, Skeleton parent) throws Exception;
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.unittest.mocks;
+
+/**
+ * Implementations of this interface perform function when a method is called. The
+ * handler is provided details of the method called along with the skeleton used
+ * for the call.
+ */
+public interface MethodCallHandler
+{
+  /**
+   * @param methodCall the method that was called
+   * @param parent     the skeleton it was called on
+   * @return           an object to be returned (optional)
+   * @throws Exception an exception in case of failure.
+   */
+  public Object handle(MethodCall methodCall, Skeleton parent) throws Exception;
+}

Propchange: incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/MethodCallHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/ReturnTypeHandler.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/ReturnTypeHandler.java?rev=822565&r1=822564&r2=822565&view=diff
==============================================================================
--- incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/ReturnTypeHandler.java (original)
+++ incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/ReturnTypeHandler.java Wed Oct  7 03:00:43 2009
@@ -1,38 +1,38 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.aries.unittest.mocks;
-
-/**
- * <p>Return type handlers return objects that implement the specified class.</p>
- */
-public interface ReturnTypeHandler
-{
-
-  /**
-   * This method is called when a method call handler has not been registered
-   * and an object of a specific type needs to be returned. The handle method
-   * is called along with the type that is required.
-   * 
-   * @param clazz  the class to create an object for
-   * @param parent the skeleton requesting the class.
-   * @return       an instance of the class, or something that can be assigned to it.
-   * @throws Exception if a failure occurs.
-   */
-  public Object handle(Class<?> clazz, Skeleton parent) throws Exception;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.unittest.mocks;
+
+/**
+ * <p>Return type handlers return objects that implement the specified class.</p>
+ */
+public interface ReturnTypeHandler
+{
+
+  /**
+   * This method is called when a method call handler has not been registered
+   * and an object of a specific type needs to be returned. The handle method
+   * is called along with the type that is required.
+   * 
+   * @param clazz  the class to create an object for
+   * @param parent the skeleton requesting the class.
+   * @return       an instance of the class, or something that can be assigned to it.
+   * @throws Exception if a failure occurs.
+   */
+  public Object handle(Class<?> clazz, Skeleton parent) throws Exception;
 }
\ No newline at end of file

Propchange: incubator/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/mocks/ReturnTypeHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message