You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by fr...@apache.org on 2007/06/26 23:18:51 UTC

svn commit: r550954 - /incubator/wicket/trunk/jdk-1.4/wicket-spring/src/main/java/org/apache/wicket/spring/test/ApplicationContextMock.java

Author: frankbille
Date: Tue Jun 26 14:18:50 2007
New Revision: 550954

URL: http://svn.apache.org/viewvc?view=rev&rev=550954
Log:
Make the class implement at least what it promises in the javadoc.
Remove the (obsolete?) method getBeanDefinitionNames(Class type) which wasn't defined in parent. It looks like something from when we had spring 1.2 dependency (in 1.2 it says "will be removed in 2.0"). Does wicket-spring enforce spring 2.0?

Modified:
    incubator/wicket/trunk/jdk-1.4/wicket-spring/src/main/java/org/apache/wicket/spring/test/ApplicationContextMock.java

Modified: incubator/wicket/trunk/jdk-1.4/wicket-spring/src/main/java/org/apache/wicket/spring/test/ApplicationContextMock.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket-spring/src/main/java/org/apache/wicket/spring/test/ApplicationContextMock.java?view=diff&rev=550954&r1=550953&r2=550954
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket-spring/src/main/java/org/apache/wicket/spring/test/ApplicationContextMock.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket-spring/src/main/java/org/apache/wicket/spring/test/ApplicationContextMock.java Tue Jun 26 14:18:50 2007
@@ -39,13 +39,13 @@
 /**
  * Mock application context object. This mock context allows easy creation of
  * unit tests by allowing the user to put bean instances into the context.
- *
- * Only getBean(String), getBean(String, Class), and getBeansOfType(Class) are
- * implemented so far. Any other method throws
- * {@link UnsupportedOperationException}.
- *
+ * 
+ * Only {@link #getBean(String)}, {@link #getBean(String, Class)}, and
+ * {@link #getBeansOfType(Class)} are implemented so far. Any other method
+ * throws {@link UnsupportedOperationException}.
+ * 
  * @author Igor Vaynberg (ivaynberg)
- *
+ * 
  */
 public class ApplicationContextMock implements ApplicationContext, Serializable
 {
@@ -83,7 +83,12 @@
 	 */
 	public Object getBean(String name) throws BeansException
 	{
-		throw new UnsupportedOperationException();
+		Object bean = beans.get(name);
+		if (bean == null)
+		{
+			throw new NoSuchBeanDefinitionException(name);
+		}
+		return bean;
 	}
 
 	/**
@@ -92,11 +97,7 @@
 	 */
 	public Object getBean(String name, Class requiredType) throws BeansException
 	{
-		Object bean = beans.get(name);
-		if (bean == null)
-		{
-			throw new NoSuchBeanDefinitionException(requiredType, name);
-		}
+		Object bean = getBean(name);
 		if (!(requiredType.isAssignableFrom(bean.getClass())))
 		{
 			throw new BeanNotOfRequiredTypeException(name, requiredType, bean.getClass());
@@ -176,14 +177,6 @@
 	 * @see org.springframework.beans.factory.ListableBeanFactory#getBeanDefinitionNames()
 	 */
 	public String[] getBeanDefinitionNames()
-	{
-		throw new UnsupportedOperationException();
-	}
-
-	/**
-	 * @see org.springframework.beans.factory.ListableBeanFactory#getBeanDefinitionNames(java.lang.Class)
-	 */
-	public String[] getBeanDefinitionNames(Class type)
 	{
 		throw new UnsupportedOperationException();
 	}